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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
There is a simple pattern for determining if a binary number is odd. what is it and why does this pattern occur? how many bits would you need if you wanted to have the ability to count up to 1000? how high could you count in binary if you used all 10 of your fingers as bits? (finger up means 1, finger down means 0)
Answers: 3
question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
question
Computers and Technology, 24.06.2019 19:20
Kiesha has a worksheet with a range of cells using the following columns: name, score, group, study group, and date. kiesha needs to sort the worksheet on the date field. which option she use to most efficiently complete this task ? a use the cut and paste option to reorganize the data to fit that order b use the filter function to organize the data based on the date c use the order function to organize the data based on the date d use the sort function to organize the data based on date order
Answers: 3
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
question
English, 30.03.2021 14:00
question
Mathematics, 30.03.2021 14:00
question
Mathematics, 30.03.2021 14:00
question
English, 30.03.2021 14:00
question
Mathematics, 30.03.2021 14:00
Questions on the website: 13722367