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 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 through for Sunday through Saturday.
Do not use classes, arrays, vector, structs, global variable and any advance features that have not been covered in this course.
You may use valuereturning function, passbyreference and passbyvalue in the assignment.
Function declarationprototype 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 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 DAYSINWEEK and MONTHSINYEAR.
It is extremely important that you use stepwise refinement when designing this program. Insufficient decomposition may result in a grade of
Required! You MUST have a single function named "printMonth that prints out ANY month, given the year, the month number, and the day of week that the month starts onThink 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 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 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 functions all together including main of them were lines or less. of them were fairly long functions but only because they were switch statements hard if not impossible to decompose further. That leaves functions that were 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 To print the year, use setw 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
