Reference no: EM132234489
Programming Assignment -
In this project, you will write a program that will play the role of a "calendar savant". The calendar in use today in the western world is called the Gregorian calendar.
a) Write a program to instruct the user to enter a date to be input as an integer month (1 to 12), an integer day of the month (1 to number-of-days-in-month), and an integer year (0 to 9999). For example, 2 1 1933 would be the 1st day of February 1933. This instruction to the user should be implemented using a function called instructions( ).
b) Your program should use a function called check( ) to determine whether the user entered a valid date. The function check( ) should return an integer value 0 if the entered date is valid, and an integer value -1 if the entered date is invalid. For example 12 44 1933 would be the 44th day of December; an invalid date. If the user inputs an invalid date, then your program should notify the user of their specific error (month outside the range of 1-12, year outside the range 0-9999, or day outside range the range 1 to number-of-days-in-month). The number-of days in each month are fixed values, except for February which has 29 days during a leap-year. Leap years are years that are divisible by 4 with no remainder, with the exception of centennial years (years divisible by 100 with no remainder) that are not divisible by 400 with no remainder. Your function check( ) will 1st check whether the entered month is between 1 and 12. If not, print-out the error, and return a -1. Then it will check the year as to whether it is between 0 and 9999, and finally the day.
If your function check( ) returns -1 to the main( ) function, your main( ) function should prompt the user to enter a valid month - day and year, starting the process over.
c) If a valid month-day-year has been entered by the user, your program will calculate the corresponding day-of -the-week. The calculation of the corresponding day-of-the-week should be done using a function called weekday( ) whose arguments are the integers month,day,year and whose return value is an integer number between 1 and 7 denoting the day of the week.
d) After the day of the week has been calculated from the date input by the user, your main program should call a 3rd function called output( ) to print the resulting day-of-the-week to the screen.
The function output( ) should use a switch statement.
e) Finally, your main program should loop to prompt the user to input another date,
f) Include comments in your program as appropriate.
To compute the day-of-the-week, use Zeller's algorithm.
Attachment:- Assignment File.rar