Question: Write a program that prints a calendar for one year, given the day of the week that January 1 falls on . Each successive month

Write a program that prints a calendar for one year, given the day of the week that January 1 falls on. Each successive month starts on the day of the week that follows the last day of the preceding month. Days of the week will be numbered 0 through 6 for Sunday through Saturday.
1. Do not use classes, arrays, vector, structs, global variable and any advance features that have not been covered in this course.
2. You may use value-returning function, pass-by-reference and pass-by-value in the assignment.
3. Function declaration/prototype is required.
Additional Requirements and Hints:
Your program must determine whether a year is a leap year exactly, not just by checking for divisibility by 4. Also remember that you are free to steal the isLeapYear function from the lessons.
The number of days in each month and the numbers in the leap year formula are not good candidates for using global constants. You should just use the literals directly in your code. However, you SHOULD use named constants for DAYS_IN_WEEK and MONTHS_IN_YEAR.
It is extremely important that you use stepwise refinement when designing this program. Insufficient decomposition may result in a grade of 0.
Required! You MUST have a single function named "printMonth()" that prints out ANY month, given (1) the year, (2) the month number, and (3) the day of week that the month starts on.(Think about why the printMonth() function will need to know the year.) The parameters must be in that order for it to pass the zyBooks tests. For example, don't create 12 separate functions, one named "printJanuary", one named "printFebruary," and so on. In addition, you must have only ONE call to this printMonth() function, in a loop that calls the function 12 times. This printMonth() function must print the entire month, including the month name and header.
You'll have to get the format just right in order to pass the zyBooks tests. After the user enters the data, the next line should be the year, and then there should be a blank line after the year. Then the printMonth() function must start by printing the month name and end by printing the blank line that separates each month from the following month. This means, for example, that there will be a blank line after the last month is printed.
Let me describe my solution to this problem, not so that you can try to match it exactly, but so that you'll know if you are going way off into the wrong direction. I had 8 functions all together including main().4 of them were 5 lines or less. 2 of them were fairly long functions but only because they were switch statements -- hard if not impossible to decompose further. That leaves 2 functions that were 8-10 lines long. One of these was the printMonth() function.
When I count lines I count only the body of the function and I don't count declaration statements or blank lines or comments, but I do count a line if it has only a } on it.
Make sure each of your functions performs a single logical task (not two). If you find yourself trying to name a function with the word AND, it probably means the function should be divided into two.
To print month names, use setw(13). To print the year, use setw(11). They don't need to be centered.
for this assignment, you should just start every month on the same day (the day entered by the user), and just print all of the dates out on a single line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!