Question: In java please. Thanks Extra Credit Exercise 24: USMoney Create a USMoney class with two integer instance variables dollars and cents. Adda constructor with two

In java please. Thanks

In java please. Thanks Extra Credit Exercise 24: USMoney Create a USMoney

Extra Credit Exercise 24: USMoney Create a USMoney class with two integer instance variables dollars and cents. Adda constructor with two parameters for initializing a USMoney object. The constructor should check that the cents value is between 0 and 99 and, if not, transter some of the cents to the dollars variable to make it between 0 and 99. Add a plus method to the dass that takes a USMoney object as its parameter. It creates and returns a new USMoney object representing the sum of the object whose plus) method is being invoked and the parameter. It does not modity the values of the two existing objects. It should also ensure that the value of the cents instance variable of the new object is between O and 99. For example, if x is a USMoney object with 5 dollars and 80 cents, and if y is a USMoney object with 1 dollar and 90 cents, then x.plus(y) will return a new USMoney object with 7 dollars and 7O cents. Also, create a USMoneyDemo class that tests the USMoney class. Exercise 25: Date Create a Date class with three integer instance variables named day, month, year. It has a constructor with three parameters for initializing the instance variables, and it has one method named daysSinceJan1). It computes and returns the number of days since January 1 of the same year, including January 1 and the day in the Date object. For example, if day is a Date object with day 1, month 3, and year 2000, then the call date.daysSinceJan1() should return 61 since there are 61 days between the dates of January 1, 2000, and March 1, 2000 including January 1 and March 1. Include a DateDemo class that tests the Date class. Don't forget leap years. . Exercise 26: Dolt What is the difference, if anything, between the following two implementations of the method dolt()? void doIt (int x) if (x0) System.out-println("Pos" else System.out-printin ("Neg" void doIt (int x) ( if(x > 0) { System.out printin"Pos" return; System.out printin ("Neg")

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!