Question: Write a program that reads a string from the keyboard and tests whether it contains a valid date. Display the date and a message that

Write a program that reads a string from the keyboard and tests whether it contains a valid date. Display the date and a message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid. The input date will have the format mm/dd/yyyy. A valid month value mm must be from 1 to 12 (January is 1). The day value dd must be from 1 to a value that is appropriate for the given month. September, April, June, and November each have 30 days. February has 28 days except for leap years when it has 29. The remaining months all have 31 days each. A leap year is any year that is divisible by 4 but not divisible by 100 unless it is also divisible by 400.

Use this algorithm for the this code:

Design a top-down solution for determining if a string in the form of MM/DD/YYYY is a valid date, if it is not print the reason. If it is a valid date print the date in the form January 6, 2020.Start with input, process, output Algorithm:1) input read the date2) Process: a) Check the string length, if bad print message and end b) Check for back slashes, if not there print message and end c) Read first two characters for month d) Convert characters to numbers e) Create one number from the two numbers f) Is it in range1-12? if not print message and set booleangoodMonth to false g) Read two characters for day h) Convert characters to numbersi) Create one day number from the two numbers j) switch on month, if bad day range print message and set booleangoodDay to false k) Read four characters for yea r l) Convert characters to numbers m) Create number year n) If the year is less than 1500 and greater than 2050 it is a bad range. Print message and set booleangoodYear to false o) if February 29 set booleanleapYearp) if February 29 and not leapYear print message and set booleangoodYear to false q)if (goodMonth && goodDay && goodYear) 3) Output a) switch on month and assign StringMonthValue (January etc. )b) print monthc) print dayd) print yearPlease use this algorithm as the basis of your program.

 Write a program that reads a string from the keyboard and

Using these variables for this code:

publicclass ValidDateBoolean{static Scanner scan = new Scanner(System.in);publicstaticvoid main(String[] args){//*** note variable names//*** Put one variable on one line.//*** note System.out.println statements for debuggingString inputString;char firstCharacterOfMonth,SecondCharacterOfMonth;char firstCharcterOfDay,secondCharcterOfDay;char firstCharcterOfYear,secondCharcterOfYear,thirdCharcterOfYear, forthCharcterOfYear;int integerValueOfFirstCharacterOfMonth;int integerValueOfSecondCharacterOfMonth;int integerValueOfFirstCharacterOfDay;int integerValueOfSecondCharacterOfDay;int integerValueOfFirstCharacterOfYear;int integerValueOfSecondCharacterOfYear;int integerValueOfThirdCharacterOfYear;int integerValueOfForthCharacterOfYear;int integerValueOfMonth;int integerValueOfDay;int integerValueOfYear;String StringMonthValue = null;// holding values January, or February etc.boolean isLeapYear;//*** goodDay, goodMonth, and goodYear start out as true.boolean goodDay = true;boolean goodMonth = true;boolean goodYear = true;

tests whether it contains a valid date. Display the date and a

Output example:

Enter the date in the format mm/dd/yyyy

02/29/2000

February, 29, 2000 is valid

Would you like to enter a new date? y

02/29/1900

Invalid day: not a leap year

please write this in Java

using eclipse preferable.

Help ME please using that algorithm and variables...

ZOOM | Date program Design a top-down solution for determining if a string in the form of MM/DD/YYYY is a valid date, if it is not print the reason, If it is a valid date print the date in the form January 6, 2020, Start with input, process, output Algorithm 1) input read the date 2) Process a) Chock the string length, if bad print message and end b) Check for back slashes, if not there print message and end c) Read first two characters for month d) Convert characters to numbers e) Create one number from the two numbers 1) Is it in rangel-12? if not print message and set boolean goodMonth to false g) Read two characters for day h) Convert characters to numbers i) Create one day number from the two numbers j) switch on month, if bad day range print message and set boolean goodDay to false k) Read four characters for year 1) Convert characters to numbers m) Create number year n) If the year is less than 1500 and greater than 2050 it is a bad range. Print message and t boolean goodYear to false o) if February 29 set boolean leapYear p) if February 29 and not leap Year print message and set boolean goodYear to false ) if (good Month && goodDay && good Year) 3) Output a) switch on month and assign StringMonth Value (January etc.) b) print month c) print day d) print year Please use this algorithm as the basis of your program. ZOOM public class Validatelolaan static Scanner scare new Scanner(System.in: public static void main(Stringarge) { spate variable rames *** Put one variable on one line //*** note System.out.println statements for debugging String inputString: char firstCharacter Month, Second Character Month char lirsiCharlerolDay, secondChartaray: char firsCharcteryear, Second Charter Olear. third Charterfear, farthCharcterOfYear; int integer ValueOfFirstCharacterMonth; int integerValur Second Characterf Month: int integerValueOfFirs.Character Day int integerValuerSecond Character Orday: int integer ValueOfFirstCharacter OfYear; int integer ValueOrSecond Character OrYear, int Integer Value Third Character Olear int integerValueOfFurthCharacter Year; int integerValue Month; Int integer Van Day int integerValueOrYear: String StringMonthValue = null; holding values January, or February at boolean isl.eapYear: //*** goodDay, goodMonth, and goodYear start out 88 true. boolean goodDay true; boolean goodMonth = true; boolean goodYear - true

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!