Zeller's congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is ● 26 (m + 1) h= q+ 10 k j +k+ + 4 4 ● where • h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday). qis the day of the month. is the month (3: March, 4: April, ..., 12: December). January and February are counted as months 13 and 14 of the previous year. jis the century (i.e. year/100) •k is the year of the century (i.e., year % 100). + 5j % 7 Note that all divisions in this exercise perform an integer division. Write a program that prompts the user to enter a year, month, and day of the month, and displays the name of the Month and the name of the day of the week using a switch.
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
JAVA code
Trending now
This is a popular solution!
Step by step
Solved in 3 steps