I have a static method I wrote:
public static Money add(Money money1, Money money2)
{
int newDollars = money1.getDollars() + money2.getDollars();
int newCents = money1.getCents() + money2.getCents();
if (newCents >= 100)
{
newDollars++;
newCents -= 100;
}
return new Money(newDollars, newCents);
}
What I need to do is to change it from a static method to a method that essentially produces the same result but using a calling object and an argument. I am not even sure how to start this. Any suggestions?????
public static Money add(Money money1, Money money2)
{
int newDollars = money1.getDollars() + money2.getDollars();
int newCents = money1.getCents() + money2.getCents();
if (newCents >= 100)
{
newDollars++;
newCents -= 100;
}
return new Money(newDollars, newCents);
}
What I need to do is to change it from a static method to a method that essentially produces the same result but using a calling object and an argument. I am not even sure how to start this. Any suggestions?????