Question: Write a Java program that prompts the user to input three positive integers: * the year, * the month, and * the calendar day and

Write a Java program that prompts the user to input three positive integers:

* the year, * the month, and * the calendar day

and prints the date in written long format, if the date is valid, or an error message, otherwise.

Note: You may explicitly assume that every date introduced is after Thursday, 14 September 1752, which corresponds to the adoption of the Gregorian calendar by Great Britain and its colonies.

Example: Suppose the user enter the year 2017, 7 as month, and 3 calenday day, then your program should output Monday, July 3rd, 2017. However, if the user introduces 2017, 2, and 29, for year, month, and calendar day respectively, your program should signal an error, since 2017 is not a leap year.

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!