Question: Write a Java application program that will allow the user to enter a date. The program will then check the date to verify whether or


Write a Java application program that will allow the user to enter a date. The program will then check the date to verify whether or not it is a valid date Begin by asking the user to enter a date in the form, mm/dd/yyyy. This will be entered as a String, since the date contains slash marks. After the date is entered, the program should check the date for validity. If the date is valid, the program should display the message "Valid date". If the date is not valid, the program should display the message "Not a valid date" along with a message to indicate why the date is not valid To check the date: . Begin by checking to make sure the user has entered enough characters. A correct date should consist of exactly 10 characters - no more and no less. If the user has not entered the correct number of characters, display whichever of the following messages is appropriate: Too few characters in the date Too many characters in the date . If the first test turned out to be ok, next you should check to make sure that the slash marks are in the correct positions. In a correctly entered date, a slash mark should be the third character in the string, and also the sixth character in the string. If you do not find slash marks at these two points, display the following message: Incorrect format .If the first two tests turned out to be ok, next you should check the month. You will need to extract the month part from the string. Since it will be extracted as a string, you will then need to convert it to an integer so you can check it's value. A valid month value must be from 1 to 12. If the month is not in the proper range, display the following message: Month is not valid .If the first three tests turned out to be ok, next check the day. You will need to extract the day part from the string. Since it will be extracted as a string, you will then need to convert it to an integer so you can check it's value. The day value should not be less than 1. It should also not be greater than 28, 29, 30 or 31; whichever is appropriate for the given month. September, April lUr
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
