Modify class Date of Fig. 8.7 to perform error checking on the initializer values for variables month,

Question:

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.

Fig. 8.7

I // Fig. 8.7: Date.java // Date class declaration. 2 3 4 5 6 7 8 9 10 II 12 13 14 15 16 17 18 19 20 21 22 23

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: