Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code in javaProject 2 : Zeller's Algorithm ( Zeller . java ) Write a Java program for Zeller's Algorithm, which can be used to determine
code in javaProject : Zeller's Algorithm
Zellerjava
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 for a month. Use the pretest while loop with a sentinelvalue structure. See Listing from
the textbook for an example of this type of structure. Do not use any exit, break, or boolean variable.
In addition, validate that the month is between and and that day is between and Use the while loop
structure for error checking. Do not use any other method or algorithm to solve this problem. See listing
for an example of this type of loop.
Algorithm:
The formula is:
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 and February is considered month 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 add a value of to G
You need to cast the following expression as an integer: M
examples:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started