1. Homepage
  2. Homework
  3. UM-SJTU VG101 22SU - Homework2 - Leap Year Calendar

UM-SJTU VG101 22SU - Homework2 - Leap Year Calendar

Engage in a Conversation
This question has been solved

Problem 3


CourseNana.COM

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). CourseNana.COM


CourseNana.COM

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,  CourseNana.COM


February has different number of days in different years (Leap year or not).  CourseNana.COM

your calendar should have a calendar header ( ------------July 2020------------ ), a day list ( SUN MON ... ), and body (exact days in that month). CourseNana.COM

The width of the header is 33, in which each position is either a dash line, or space, or characters, or numbers. CourseNana.COM

The width of each day in the body is 5. CourseNana.COM

Decompose your program into at least 2 functions. You can assume that the year is greater than 1900. CourseNana.COM

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). CourseNana.COM


CourseNana.COM

Example: CourseNana.COM

generateCalendar(6, 2021) CourseNana.COM

 

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Matlab代写,Calendar代写,Matlab代编,Calendar代编,Matlab代考,Calendar代考,Matlabhelp,Calendarhelp,Matlab作业代写,Calendar作业代写,Matlab编程代写,Calendar编程代写,Matlabprogramming help,Calendarprogramming help,Matlabassignment help,Calendarassignment help,Matlabsolution,Calendarsolution,