Homework 4-3 Write a program named DateConverter that asks the user for a date entered as 4 integers: dayNumber monthNumber date year. The program should then convert the dayNumber to a dayName and the monthNumber to a monthName. Finally, if the input is a valid date the program must print out the specified date in the following format: dayNumber monthNumber date year is dayName monthName date, year Note: dayNumber is an integer from 1-7, where 1 = Sunday, 2 = Monday, ..., 7 = Saturday monthNumber is an integer from 1-12, where 1 = January, 2= February, ..., 12 December date is an integer from 1-31 representing the date. year is an integer representing the year. Your prompt to the user must be: Enter 4 integers representing dayNumber monthNumber date year: It is very important to note that the program will have to error check the input as follows: 1. Check that the dayNumber is in the range 1..7. If not, the program terminates after printing: Invalid day number: dayNumber, please enter a number from 1..7. 2. Check that the monthNumber is in the range 1..12. If not, the program terminates after printing: Invalid month number: monthNumber, please enter a number from 1..12. 3. Check that the date is in the range 1..31. If not, the program terminates after printing:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This is using the java coding platform.

Homework 4-3
Write a program named DateConverter that asks the user for a date entered as 4 integers: dayNumber
monthNumber date year.
The program should then convert the dayNumber to a dayName and the monthNumber to a monthName.
Finally, if the input is a valid date the program must print out the specified date in the following format:
dayNumber monthNumber date year is dayName monthName date, year
Note:
dayNumber is an integer from 1-7, where 1 = Sunday, 2 = Monday, ..., 7 = Saturday
monthNumber is an integer from 1-12, where 1 = January, 2 = February, 12 December
date is an integer from 1-31 representing the date.
year is an integer representing the year.
Your prompt to the user must be:
Enter 4 integers representing dayNumber monthNumber date year:
It is very important to note that the program will have to error check the input as follows:
1. Check that the dayNumber is in the range 1..7. If not, the program terminates after printing:
Invalid day number: dayNumber, please enter a number from 1..7.
2. Check that the monthNumber is in the range 1..12. If not, the program terminates after printing:
Invalid month number: monthNumber, please enter a number from 1..12.
3. Check that the date is in the range 1..31. If not, the program terminates after printing:
Transcribed Image Text:Homework 4-3 Write a program named DateConverter that asks the user for a date entered as 4 integers: dayNumber monthNumber date year. The program should then convert the dayNumber to a dayName and the monthNumber to a monthName. Finally, if the input is a valid date the program must print out the specified date in the following format: dayNumber monthNumber date year is dayName monthName date, year Note: dayNumber is an integer from 1-7, where 1 = Sunday, 2 = Monday, ..., 7 = Saturday monthNumber is an integer from 1-12, where 1 = January, 2 = February, 12 December date is an integer from 1-31 representing the date. year is an integer representing the year. Your prompt to the user must be: Enter 4 integers representing dayNumber monthNumber date year: It is very important to note that the program will have to error check the input as follows: 1. Check that the dayNumber is in the range 1..7. If not, the program terminates after printing: Invalid day number: dayNumber, please enter a number from 1..7. 2. Check that the monthNumber is in the range 1..12. If not, the program terminates after printing: Invalid month number: monthNumber, please enter a number from 1..12. 3. Check that the date is in the range 1..31. If not, the program terminates after printing:
4. Check the date for validity. For example, there is no February 30, February 31, April 31, June 31,
September 31, November 31. If the date is invalid, the program terminates after printing:
Invalid date: monthName, does not have date days, please enter a valid date.
5. Lastly, if the monthNumber = 2, and date = 29 you must verify that the year entered is a leap year,
which is the only time that February 29 exists. Please see Wikipidia's Page on Leap Year.
If the year is not a leap year and the user entered date = 29, the program terminates after printing:
Invalid date: year is not a leap year, February does not have date days,
please enter a valid date.
How to determine whether a year is a leap:
To determine whether a year is a leap year, follow these steps:
1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5.
2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4.
3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5.
4. The year is a leap year (it has 366 days).
5. The year is not a leap year (it has 365 days).
Please note that your class should be named DateConverter.
Transcribed Image Text:4. Check the date for validity. For example, there is no February 30, February 31, April 31, June 31, September 31, November 31. If the date is invalid, the program terminates after printing: Invalid date: monthName, does not have date days, please enter a valid date. 5. Lastly, if the monthNumber = 2, and date = 29 you must verify that the year entered is a leap year, which is the only time that February 29 exists. Please see Wikipidia's Page on Leap Year. If the year is not a leap year and the user entered date = 29, the program terminates after printing: Invalid date: year is not a leap year, February does not have date days, please enter a valid date. How to determine whether a year is a leap: To determine whether a year is a leap year, follow these steps: 1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. 2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. 3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. 4. The year is a leap year (it has 366 days). 5. The year is not a leap year (it has 365 days). Please note that your class should be named DateConverter.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education