subject

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. Do not use classes, arrays, or structs in this project!!- 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 -- bool isLeapYear(int year) { if (year % 400 == 0){ return true; } if (year % 100 == 0){ return false; } if (year % 4 == 0){ return true; } return false; }-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.-It is extremely important that you use stepwise refinement when designing this program. Insufficient decomposition may result in a grade of 0.-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.) 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.-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 with 12 branches -- hard if not impossible to decompose further. That leaves 2 functions which 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.-Printing out the month names: They don't need to be centered. Each month name should start right above the letter "T", as illustrated in the sample output. Sample Output: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. So, the output for this assignment will look like this:What year do you want a calendar for? 2002What day of the week does January 1 fall on (0 for Sunday, 1 for Monday, etc.)? 2 2002 January S M T W T F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 February S M T W T F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 . . . . December S M T W T F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:00, ziahziah
Which function key is used to enable the spelling & grammar function in a word processing program such as microsoft word?
Answers: 3
image
Computers and Technology, 22.06.2019 01:20, karreemgrant2
What is the full meaning of rfid in computer
Answers: 2
image
Computers and Technology, 22.06.2019 16:30, buky0910p6db44
Corey set up his presentation for delivery to his team. the information he had to convey was critical to their job performance. he knew he would need a lot of time to explain each point
Answers: 3
image
Computers and Technology, 23.06.2019 01:00, Ltik11900
Write the command that can be used to answer the following questions. (hint: try each out on the system to check your results.) a. find all files on the system that have the word test" as part of their filename. b. search the path variable for the pathname to the awk command. c. find all files in the /usr directory and subdirectories that are larger than 50 kilobytes in size. d. find all files in the /usr directory and subdirectories that are less than 70 kilobytes in size. e. find all files in the / directory and subdirectories that are symbolic links. f. find all files in the /var directory and subdirectories that were accessed less than 60 minutes ago. g. find all files in the /var directory and subdirectories that were accessed less than six days ago. h. find all files in the /home directory and subdirectories that are empty. i. find all files in the /etc directory and subdirectories that are owned by the group bin."
Answers: 1
You know the right answer?
Write a program that prints a calendar for one year, given the day of the week that January 1 falls...

Questions in other subjects:

Konu
Biology, 23.08.2019 20:30