Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the project Write a Java application program that will allow the user to enter a date. The program will then check the date to verify

image text in transcribedimage text in transcribedimage text in transcribed

the project 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 the month is not in the proper range, display the following message Month is not valid Yo . If the first three tests turned out to be ok, next check the day. You will need to extract the day from the string. Since it will be extracted as a string, you will then need to convert it to an inte so you can check it's value. The day value should not be less than 1. It should also not be thi

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions