The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Beginner Programming Help

Hello, I am stuck on an assignment that is asking me to create a class (USMoney), and inside that class create a method that will use an object of that class as an input parameter for the method call. I completely understand the rest of the assignment, I just cannot figure out the plus method...

Where in the instructions does it say anything about recognizing objects created in the tester class? According to what I read the plus method is to accept a USMoney object as a parameter, and then create and return a new USMoney object. So if I have a USMoney object as such:
USMoney personalSavings;
and a USMoney object as such:
USMoney personalSpending;
and using the plus method I would be able to see what I am worth in US Cash as such:
USMoney myValueInUSMoney = personalSavings.plus(personalSpending);
in a way that my personalSavings has not been modified, nor has my personalSpending. The USMoney class does not need to know what the test class does with this myValueInUSMoney object. It just has to know how to add the balance of the personalSpending to the balance of the personalSavings and create a new USMoney object using the sum of the personal objects.

public static double plus()
{

}

SHOULD BE

public int plus()
{

}

I think...

What makes you think that? (Not that you are right or wrong) There are valid reasons to make a method static, does this method qualify as static or non-static? Why?