subject

Java Programming Create a USMoney class with two private integer instance variables named dollars and cents. Add a 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, transfer some of the cents to the dollars variable to make it between 0 and 99.
Add a plus() method to the class 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. Hint: Your USMoney object may require both a getDollars() method and a getCents() method.
The plus() method does not modify 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 0 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 70 cents.
Of course, you will need to create a USMoneyDemo class that tests the USMoney class. Your USMoneyDemo should prompt the user twice. The first to enter an integer representing dollars and the second to enter an integer representing cents. Use these values to create the first object named x. Do it again for the object named y. Do not worry about putting these prompts in a loop for now.
Be sure to add some documentation and put any partner(s) names in the main application's doc box.
For Part 1, submit two files on Blackboard: USMoney. java and USMoneyDemo. java
Part 2 – 25 points
Create a Date class with three private integer instance variables named day, month, year. It has a constructor with three parameters for initializing the instance variables, and it has a method named daysSinceJan1(). Note: It could have other methods.
Just as its identifier suggests, the daysSinceJan1() method computes and returns the number of days since January 1 of the same year, including January 1 and the day in the Date object itself.
Create a DateDemo class that tests the Date class. First prompt the user to enter an integer representing the day, a second prompt to enter an integer representing the month and a third to enter an integer representing the year. (Do not worry about doing any validation of the values entered.) Then, instantiate your Date object with these values. After that, call the method DaysSinceJan1() to display the answer.
An example would be that the user enters values of day = 1, month = 3, and year = 2019, then the call day. daysSinceJan1() should return 60 since there are 60 days between the dates of January 1, 2019, and March 1, 2019. In leap years, it should return 61.
Note that, in a leap year like 2020 will be, there will be one more day counted between January 1 and any date following February 28. What are the rules for leap years? If the year is evenly divisible by four, then it is a leap year...but not always! If it is a century year such as 1900 or 2000, it is only a leap year if evenly divisible by 400. Therefore, the century year 2000 WAS a leap year but 1900 was NOT a leap year! Neither were 1700 or 1800 and neither will be 2100...but 1600 was!
You may NOT use an Array or ArrayList (or any other type of array) and you may not use any of the Java API date classes and/or methods.
Document like you did for Part 1.
For Part 2, submit two files on Blackboard: Date. java and DateDemo. java

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
question
Computers and Technology, 23.06.2019 21:40
language consists of basic components, and they are called a. 3; mental images, concepts, and speech b. 2; language acquisition and linguistic relativity c. 3; heuristics, algorithms, and analogies d. 4; phonemes, morphemes, syntax, and semantics e. 2; words and grammar
Answers: 3
question
Computers and Technology, 24.06.2019 02:00
Which steps will open the system so that you can enter a question and do a search for
Answers: 1
question
Computers and Technology, 24.06.2019 02:10
Which sentences describe the things you need to ensure while creating a sketch and a drawing? while an artistic or creative drawing is a creative expression, a technical drawing is an informative expression. you need to create accurate and neat drawings to convey accurate information. a technical drawing clearly conveys its meaning or information, and does not leave room for interpretation maintain a good speed while creating drawings
Answers: 1
You know the right answer?
Java Programming Create a USMoney class with two private integer instance variables named dollars...
Questions
question
English, 19.11.2020 21:40
question
Mathematics, 19.11.2020 21:40
question
Mathematics, 19.11.2020 21:40
question
English, 19.11.2020 21:40
question
Mathematics, 19.11.2020 21:40
Questions on the website: 13722367