Question: Please update my code: You should implement the functions in this order: void printMonthYear(int mon) There are no tricks to this function. void printDaysOfWeek() There

Please update my code:

Please update my code: You should implement the functions in this order:

void printMonthYear(int mon) There are no tricks to this function. void printDaysOfWeek()

You should implement the functions in this order:

void printMonthYear(int mon)

There are no tricks to this function.

void printDaysOfWeek()

There are no tricks to this function.

int getFirstDayOfMonth(int mon, int year)

Read about Zeller's algorithm here. Here is the pseudo code for Zellers algorithm:

declare adjusted month, set to (mon + 9) % 12 + 1

declare adjusted year, set to year - 2000

if adjusted year is greater than 10:

subtract one from year

declare day, set to 1

declare century, set to 20

declare output, set to

(13 * mon - 1) / 5 + year / 4 + century / 4 + day + year - 2 * century;

mod output by 7

add 7 to output

mod output by 7 again

return output

int getNumOfDaysInMonth(int mon, int year)

There are no tricks to this function. Use if statements as needed. Dont worry about leap years.

void printDays(int mon, int year)

You will need to call getFirstDayOfMonth to know how many spaces to insert at the beginning of the month.

You will need to call getNumOfDaysInMonth to know how many days are in the month.

Do not copy your previous C code for printing a calendar.

Implement the pseudocode as follow (this will make your life easier when writing x86):

declare dayOfWeeek, set to call getFirstDayOfMonth

for 0 to dayOfWeek:

print 3 spaces

declare daysInMonth, set to call GetNumOfDaysInMonth

for 1 to daysInMonth:

print the number of the day

if (i + dayOfWeek) % 7 == 0:

print newline

print newline

The output should look like this:

There are no tricks to this function. int getFirstDayOfMonth(int mon, int year)

1 #include 12) 13 14 15 16 17 18 19 20 21 printf("Invalid return 1; month: %d! Must be between 1 and 12 ", mon); printf(Year: "); scanf("%d", &year); if (year 2000) printf("Invalid return 1; later !in", year); 23 24 25 26 27 printf("In"); 28 printMonthYear(mon, year); 29 printDays0fWeek); 30 printDays (mon, year) 31 year: %d! Must be 2000 or 34 35 Prints the month and year as a line 36 * January=1 December-12 37 38 For example: 39 printMonthYear (1, 2000)January 2000 40/ 41 void printMonthYear(int mon, int year); 42 43/s 44 Prints Su Sa. 45 Each day should be 46 47 void printDaysofWeek ); 48 49 /** 50 Use the Zeller algorithm to determine which the first day of the month 51 Returns the first day of the week from a given month 52Sunday-0 . Saturday 6 54 int getFirstDayOfMonth(int mon, int year); 56 /* 57 Returns the number of days in the given month 58 Don't worry about checking for leap years. 59 60 int getNumOfDaysInMonth(int mon, int year); 61 62 /* 63 Prints every day of the month 64 This will print each numeric line in the calendar. 65 66 For example: 67 1 2 3 4 5 6 7 68 8 9 10 11 12 13 14 69 70 void printDays (int mon, int year); 71 Month: 1 Year: 2019 January 2019 Su Mo Tu We Th Fi Sa 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

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 Databases Questions!