Question: **in Java** Part One: Define a class named Money whose objects represent amounts of U.S. money. The class should have two instance variables of type

**in Java**

Part One: Define a class named Money whose objects represent amounts of U.S.

money. The class should have two instance variables of type int for the dollars and

cents in the amount of money. Include a constructor with two parameters of type

int for the dollars and cents, one with one constructor of type int for an amount of

dollars with zero cents, and a no-argument constructor. Include the methods add and

minus for addition and subtraction of amounts of money. These methods should be

static methods, should each have two parameters of type Money, and return a value

of type Money. Include a reasonable set of accessor and mutator methods as well as

the methods equals and toString. Write a test program for your class.

Part Two: Add a second version of the methods for addition and subtraction.

These methods should have the same names as the static version but should use a

calling object and a single argument. For example, this version of the add method

(for addition) has a calling object and one argument. So m1.add(m2) returns the

result of adding the Money objects m1 and m2. Note that your class should have all

these methods; for example, there should be two methods named add.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!