Write a C++ program to create a calendar for a year. The program reads the year from the keyboard. It then calculates which day of the week (SUN, MON, TUE, WED, THU, FRI, SAT) is the first day of the year and prints the calendar for that year. After printing the year, it should ask if the user wants to continue. If the answer is yes, it will print the calendar for another year until the user is done.
The program prompts the user for the input, as shown in the next example:
Enter the year for your calendar: 2017
The output is a calendar for the whole year (12 months). One month is shown in the next example:
To print the correct calendar for the requested year, you must first find which day of the week is the first day of that year. This can be done with the following formula: see image.
You must also calculate leap years. The formula for this calculation is:
(!(year % 4) && (year % 100)) || !(year % 400)
Requirements
You must use a modular design. The main function should consist of little more than declarations and function calls.
All functions must have prototypes, declared before main. All function definitions must appear below main.
All functions must be properly documented. State the purpose of the function, the purpose of each of its parameters, and what the function returns.
Your program should handle user input errors gracefully.
Calendar formatting should be exactly as shown in the sample above.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.