Question: Use java to make the code and run it through the onlineIDE https://www.onlinegdb.com/ Write a program that reads in the following data, all entered on

Use java to make the code and run it through the onlineIDE https://www.onlinegdb.com/

Use java to make the code and run it through the onlineIDE

Write a program that reads in the following data, all entered on one line with at least one space separating them: a) an integer representing a month b) an integer representing the day of the month c) an integer representing a year 1. Check that the month is between 1 and 12. If it's not print an error message. 2. Day cannot be o or less nor can it be more than 31 for all months. Print an error message if these conditions occur. If day is in the range of 0 and 31, you will still need to check other conditions as noted below in 4. 3. Year cannot be less than 1. Print an error message if that occurs. If any one of these three conditions occurs, only one error message should print and no further code should be executed. If everything is good so far, then continue as below: 4. Check that day is correct for the month. Remember the poem 30 days has September, April, June and November, All the rest have 31 except February which has 28 but in a leap year has 29" a. For all months, except February, you can check if the date is valid by the poem above. i. If the month has more days than allowed, print a message saying month number NN can not have XXX days (e.g., if the input is 6 31 2018 the message should say month 6 cannot have 31 days) b. If the month is February, you'll need to check if the year is a leap year and then decide if the date is correct. Page 97 in the textbook shows code to determine a leap year. A year is a leap year if (1) it's divisible by 400 OR (2) the year is divisible by 4 AND not divisible by 100. So, if it's a leap year any day up to and including 29 is valid, otherwise 28 is the largest date in February. If February has too many days, e.g., the input is 2 29 2001, print an error message stating 2001 is not a leap year, Feb can have only 28 days 5. At any point that you determine that a date is valid, print a message in the format 5 18 2017 is a valid date 6. Your code should print only one message if a date is valid. 7. If it's invalid, print only one error message. It a date has more than one error for example, the input is 6 45 -1234, it doesn't matter which error you pick first as long as you indicate only one error

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!