Problem 3
Background: A year is a leap year if it is divisible by 4 (e.g., 2004), unless it is divisible by 100 in which case it is not (e.g., 1900), unless it is divisible by 400 in which case it is (e.g.,2000).
Question: Write a primary function generateCalendar that takes two arguments, representing the month and year, and output the monthly calendar of the specified month and year in the following format. Note that,
February has different number of days in different years (Leap year or not).
your calendar should have a calendar header ( ------------July 2020------------ ), a day list ( SUN MON ... ), and body (exact days in that month).
The width of the header is 33, in which each position is either a dash line, or space, or characters, or numbers.
The width of each day in the body is 5.
Decompose your program into at least 2 functions. You can assume that the year is greater than 1900.
Hint: Zeller’s Congruence, and use field width to format your calendar. There is no exact calendar format for your calendar (The number of fillers, like ' - ' and space, could vary).
Example:
generateCalendar(6, 2021)