Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java i need help with the following code. JAVA Ask user to enter a date in format MM/DD/YYYY. Convert the date to its word

in java i need help with the following code. JAVA

image text in transcribed

Ask user to enter a date in format MM/DD/YYYY. Convert the date to its word representation as follows: - print English name of the month - print English representation of the day, e.g. first, second, ..., thirty first. - print English representation of the year, composed of two parts: - century part ranging from 10 to 99 - year part in range from 0 to 99. Note: display "zero" suffix when printing single-digit years. - For example, - year 2003 becomes twenty zero three - year 1992 should result in nineteen ninety two Programming such application may seem like an impractical idea, but it can be very useful if you wish to submit resulting string to a text-to-voice converter and have your program "say" the result. Have the program ask for the dates in endless loop. Here is a sample console interaction with the user: Welcome to the Date to Words Converter! Enter a date in format MM/DD/YYYY >12/12/2012 December twelve, twenty twelve Enter a date in format MM/DD/YYYY >8/3/1492 August third, fourteen ninety two Enter a date in format MM/DD/YYYY >1/31/2005 January thirty first, twenty zero five - . Make sure that all of the above requirements are met. Then, add the code to validate the entered date as follows: 1. Verify that the month range is correct. If not, tell the user. 2. Verify that the day range of the month is correct. If not, tell the user. You can use a switch statement based on the integer month's value to do your checks. 3. February is a bit tougher to verify, because in a leap year it has 29 days. Here is a method to determine if it's a leap year or not: boolean is leap year int year) if ( ( year (100)==0){ return ( (year o 400==0) ? true : false ); \} else \{ return ( (year 4.4=0) ? true : false ); \}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions