Perform error-checking on the initial values


Create a class called Date.java to perform error-checking on the initial values for instance: fields month, day and year. As well, give a method nextDay() to increment the day by one. The Date object must always remain in a consistent state.

Create a class called DateTest.java which prompts the user to enter the month, day, and year as numeric values. This program then makes a Date object by using the Date class you just created and tests the nextDay() method. This can be done in a loop of 40 iterations: the Date object calls the nextDay() method and prints the date during each iteration of the loop. This loop is to describe that the nextDay() method works correctly.

The attribute variables of a class require to be declared private.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Perform error-checking on the initial values
Reference No:- TGS015491

Expected delivery within 24 Hours