Question: code should be written in simple java Problem: The purpose of this assignment is to gain experience solving exception handling in your Java code. Write
Problem: The purpose of this assignment is to gain experience solving exception handling in your Java code. Write a program that reads a string from the keyboard and tests whether it contains a valid date Display the date as described below if it is valid, otherwise input date should have the format mm/dd/vyy, where mm and dd can be one or two digits display a message as described below. The Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from the user(give an example of the fornat you are expecting the user to use when entering the date) and check for the following: a. missing one of parts (that is the month or the day or the year is missing. Check this by checking the number of slashes ()), eg mm/dd is invalid b. mm or dd or yyyy is not numeric c. month not between 1 and 12 d. day is not in the right range (this depends on the month) e. year isn't 2000 or higher If the user gives you invalid input, start the whole process again by asking the user for a valid date, Keep prompting the user until you get a valid date. A while Evalid) loop would work well here. If the date is valid, then output a message with a copy of the input date values indicating it isa valid date" Bonus Mark: One of the checks should be for leap years. February has 28 days except for leap years when it has 29. A leap year (for the 2000s) is any ycar divisible by 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
