Question: in java ( Enhancing Class Date ) Modify class Date of Fig. 8 . 7 to perform error checking on the initializer values for variables

in java
(Enhancing Class Date) Modify class Date of Fig. 8.7 to perform error checking on the
initializer values for variables month, day and year (currently it validates only the month
and day). Provide a method nextDay to increment the day by one. Write a program that
tests method nextDay in a loop that prints the date during each iteration to illustrate that
the method works correctly. Test the following cases:
a) incrementing into the next month and
b) incrementing into the next year.
(Enhancing Class Time2) Modify class Time2 of Fig. 8.5 to include a tick method that
increments the time stored in a Time2 object by one second. Provide method
incrementMinute to increment the minute by one and method incrementHour to
increment the hour by one. Write a program that tests the tick method, the
incrementMinute method and the incrementHour method to ensure that they work
correctly. Be sure to test the following cases:
a) incrementing into the next minute,
b) incrementing into the next hour and
c) incrementing into the next day (i.e.,11:59:59 PM to 12:00:00 AM).
4.(Date and Time Class) Create class DateAndTime that combines the modified Time2
class and the modified Date class of the previous question 3. Modify method
incrementHour to call method nextDay if the time is incremented into the next day.
Modify methods toString and toUniversalString to output the date in addition to
the time. Write a program to test the new class Date-AndTime. Specifically, test
incrementing the time to the next day.

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!