Suggested Logic: • Display a Title • Get the month from the user • Validate the month • Get the day from the user • Validate the day Get the year from the user • Calculate the day of the week o Convert M (month) to the correct value and change year is necessary o Convert the year to C and D o After setting up the values for M, K, C, and D, use Java operators to apply the formula o Get the value of G Display the day of the week using a switch statement: o Gis the day of the week where: • 0= Sunday • 3= Wednesday 6 = Saturday 1= Monday 4 = Thursday Any other value: Display an error message. 2= Tuesday 5 = Friday • Display the number of entries made by the user Testing: Test your final program for these values plus others including your own birth date: Month Day Year Result 1899 Sunday Monday 2014 2000 Wednesday 1 3 10 1 19 Here is a sample output of this project: Zeller's Algorithm Enter month ( or e to exit): 9 Enter day: Enter year: The day is Thursday 2003 Enter month ( or e to exit): 2 Enter day: Enter year: The day is Friday 14 2014 Enter month ( or e to exit): e Number of entries - 2
Need help with revising and completing my code using requirements. NO tutor is using the formst suggested which is very confusing for me. Please try to do it using
Display a Title
• Get the month from the user
• Validate the month
• Get the day from the user
• Validate the day
• Get the year from the user
• Calculate the day of the week
o Convert M (month) to the correct value and change year is necessary
o Convert the year to C and D
o After setting up the values for M, K, C, and D, use Java operators to apply the formula
o Get the value of G • Display the day of the week using a switch statement: o G is the day of the week where:
0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
Any other value: Display an error message.
• Display the number of entries made by the user
![Suggested Logic:
• Display a Title
• Get the month from the user
• Validate the month
• Get the day from the user
• Validate the day
• Get the year from the user
• Calculate the day of the week
o Convert M (month) to the correct value and change year is necessary
o Convert the year to C and D
o After setting up the values for M, K, C, and D, use Java operators to apply the formula
o Get the value of G
Display the day of the week using a switch statement:
o Gis the day of the week where:
• 0 = Sunday
• 3 = Wednesday
• 6 = Saturday
1 = Monday
4 = Thursday
Any other value: Display an error message.
2 = Tuesday
5 = Friday
• Display the number of entries made by the user
Testing:
Test your final program for these values plus others including your own birth date:
Month Day
|1
Year Result
1899
10
2014
19
2000 Wednesday
Sunday
Monday
3
1
Here is a sample output of this project:
Zeller's Algorithm
Enter month ( or e to exit): 9
Enter day:
Enter year:
The day is Thursday
2003
Enter month ( or e to exit): 2
Enter day:
Enter year:
The day is Friday
14
2014
Enter month ( or e to exit): 0
Number of entries - 2](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb27e094d-c3af-4ccc-a444-1f89e096dd09%2F792187db-2a15-4b5a-b5c8-254ba1044d33%2Fgsrzfu9_processed.jpeg&w=3840&q=75)
![Write a Java program for Zeller's Algorithm, which can be used to determine the day of the week for any date
in the past, present, or future.
The program should request the user to enter the date values (month, day, and year). Next, the program should
apply the algorithm (see below), and display the appropriate day of the week. The program should loop until the
user enters 0 for a month. Use the pre-test while loop with sentinel-value structure.
In addition, validate that the month is between 0 and 12; and that day is between 1 and 31. Use the while loop
structure for error checking.
Algorithm:
The formula is:
G=([2.6M – .2 ] +K +D+ [D/4] + [C/4] – 2C) mod 7
where:
M: is the month number
K: is the day of the month
C: is the century number
D: is the year number
explanations:
M: March is considered month 1 and February is considered month 12. Therefore,
January and February are considered to be part of the previous year.
C: Is the first two digits of the year
D: Is the last two digits of the year
G: If this value is less than 0, add a value of 7 to G
You need to cast the following expression as an integer: [2.6 M – .2]
examples:
Month
Day
Year
M
K
D
76
7 (not 8)
7
4
1776
2008
4
17
1
17
11
17
20](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb27e094d-c3af-4ccc-a444-1f89e096dd09%2F792187db-2a15-4b5a-b5c8-254ba1044d33%2Fmzp0ejb_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)