This assignment is a continuation of the last assignment. I'll repeat the introductory information here.
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!! (If you don't know what they are, don't worry, you aren't using them.)
Your output should look exactly like the one in this sample screen output:
What year do you want a calendar for? 2022
What day of the week does January 1 fall on?
(Enter 0 for Sunday, 1 for Monday, 6 for Saturday, etc.): 4
2022
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
March
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
April
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
May
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
June
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
July
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
August
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
September
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
October
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
November
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
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
All of the requirements from your last assignment (part 1 of this assignment) still apply.
If your part 1 of this assignment was written well, this part, part 2, should be completed by making just two changes: (1) One or more parameters may need to be modified. You shouldn't need to add or delete any parameters. (2) Inside the for loop that prints the dates, add an if or if/else statement. Among other things, this statement should contain a cout << endl; to force a new line when the day is saturday.
Depending on your approach, making it so that there is not an extra blank line printed when Saturday is the last day of the month can be a little tricky. In case that turns out to be your last error to correct, I have something like this (inside the for loop):
if (it's time to reset the day-of-week counter){
reset the day-of-week counter;
if (this is not the last day of the month) {
cout << endl;
}
}
The basic idea here is that you will use a variable to always represent the current day of the month, throughout many of the functions. That way, when you go to print the first day of the following month, you can just check the value of that variable to see what day of the week the month should start on. Other than the increment operator (++), do not use any arithmetic operators to figure out what the first day of the month should be, especially not the % operator.
Don't forget to document your code according to Style Convention 1.