Create a class named Date that stores date values and prints out the date in either a pure numeric format or a name and number format (see sample session for format details). Date class notes: In your driver class, include a loop that repeatedly: : Enter a date in the form mm/dd (“q” to quit): 05/02 May 2 Enter a date in the form mm/dd (“q” to quit): 05/02 May 2 Enter a date in the form mm/dd (“q” to quit): Invalid date format – 52 Enter a date in the form mm/dd (“q” to quit): Invalid format – For input string: “5.0” Enter a date in the form mm/dd (“q” to quit): Invalid month – 13 Enter a date in the form mm/dd (“q” to quit): Invalid format – For input string: “x” Enter a date in the form mm/dd (“q” to quit): Invalid day – 30 Enter a date in the form mm/dd (“q” to quit): 02/28 February 28 Enter a date in the form mm/dd (“q” to quit):

The Date class is a custom class that is used to store and manipulate date values. It provides methods to print out the date in different formats, such as a pure numeric format or a name and number format.

In the driver class, there is a loop that repeatedly prompts the user to enter a date in the format mm/dd. If the user enters “q” as the input, the loop terminates and the program ends. Otherwise, the input is processed by the Date class, and the corresponding date is printed out in the desired format.

The Date class has some validation checks to ensure that the input is in the correct format. If the input is not in the format mm/dd, an error message is displayed. Similarly, if the month or day values are invalid (e.g. month value > 12 or day value > 31), appropriate error messages are displayed.

Let’s consider an example session to understand the format details:

Enter a date in the form mm/dd (“q” to quit): 05/02
Output: May 2

In this example, the user entered the date 05/02. The Date class processed this input and printed out the corresponding date in the required format, which is “May 2”.

Enter a date in the form mm/dd (“q” to quit): 05/02
Output: May 2

This time, the user entered the same date 05/02. The Date class processed the input again and produced the same output as before, “May 2”.

Enter a date in the form mm/dd (“q” to quit): Invalid date format – 52

Here, the user entered an invalid date format, which is not in the form mm/dd. Therefore, the Date class displays an error message indicating that the date format is invalid.

Enter a date in the form mm/dd (“q” to quit): Invalid format – For input string: “5.0”

In this case, the user entered an invalid format for the month value. The Date class recognizes this error and displays an appropriate error message indicating that the format is invalid.

Enter a date in the form mm/dd (“q” to quit): Invalid month – 13

Here, the user entered an invalid month value, which is greater than 12. The Date class detects this error and displays an error message stating that the month is invalid.

Enter a date in the form mm/dd (“q” to quit): Invalid format – For input string: “x”

In this example, the user entered an invalid input string that cannot be converted to a valid date format. The Date class identifies this error and displays an error message indicating that the format is invalid.

Enter a date in the form mm/dd (“q” to quit): Invalid day – 30

Here, the user entered an invalid day value, which is greater than 31. The Date class recognizes this error and displays an error message stating that the day is invalid.

Enter a date in the form mm/dd (“q” to quit): 02/28
Output: February 28

In this last example, the user entered a valid date 02/28. The Date class processes this input and prints out the corresponding date in the required format, which is “February 28”.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer