The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
(Science : day of kthe week ) Zeller 's congruence is an algorithm developed by Christian Zeller to calculate the day of the week .The formula is
h = ( q + ( 26 (m+1) ) / 10 + k + k/4 + j/4 + 5j ) % 7
where
h -- is the day of the week ( 0 : saturday , 1 : sunday , 2 : monday , 3 : Tuesday, 4 : Wednesday , 5 : Thursday , 6 : Friday)
q -- is the day of the month
m -- is the month ( 3 : March,4 : April ,....., 12 : December ) . January and februray are counted as months 13 and 14 of the previous year.
j -- is the centutry (i.e., year/100 )
k -- is the year of the centuary (i.e., year % 100 ).
Note that the divison in the formula performs an integer division.
• Implement the UI (user interface) according to the sample runs given in this document INSTEAD OF the ones given in the textbook.
• You need to check validity of the entered values:
o Year: starting with 1
o Month: 1 through 12
o Day of Month: depending on the month and year combined (for example, valid Day of Month would be 1 through 31 for January, 1 through 30 for April, etc.) Watch out for the leap year! February has 29 days in leap years and only 28 days in non-leap years!
• When an invalid value is entered, your program should display an error message and terminates! Display an appropriate error message according to the following where xxx is the invalid value received, YYYY is the given year and MM is the entered month: o Year: “xxx is an invalid Year!”
oMonth: “xxx is an invalid Month! ”
oDay of Month: “xxx is an invalid Day of Month for YYYY/MM! ”
• Sample runs (each box represents an independent execution of the program): Enter year (e.g., 2012): 2015
Enter month (1 ~ 12): 10
Enter the day of the month (1 ~ 31): 20
2015/10/20 is Tuesday.
Enter year (e.g., 2012): 0
0 is an invalid Year!
Enter year (e.g., 2012): 2015
Enter month (1 ~ 12): 13
13 is an invalid Month!
Enter year (e.g., 2012): 2015
Enter month (1 ~ 12): 2
Enter the day of the month (1 ~ 31): 29
29 is an invalid Day of Month for 2015/2!
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll