Assignment 3

Due 12/10/2005

 

KR041.c is a short sample program that determines if a given year is a leap year. Given the additional information that January 1, 1900 is a Monday, the following short exercise programs require you to compute and output day-of-the-week information. They may eventually lead to the UNIX “cal” program, which generates calendars such as this. A concatenation of all calendars between 1900 and 2100 can be found here to help you verify your answer.

 

3.1.        Write a program to read in a year between 1900 and 2100, and then print out 0 if the first day of that year is a Sunday, 1 if it is a Monday, etc.

3.2.        Modify program 3.1 to repeat the process until –999 is entered.

3.3.        Modify program 3.1 to list the same day-of-the-week information for all years between 1900 and 2100 in increasing order.

3.4.        Write a program to read in a month and a year between 1900 and 2100, and then print out 0 if the first day of that month is a Sunday, 1 if it is a Monday, etc.

3.5.        Modify program 3.4 to list the same day-of-the-week information for all months between January 2000 and December 2010 in increasing order.

3.6.        Create this year’s calendar with one row for each month. The output should look like this. (The output is a bit long, so you may have to reduce the font size to avoid lines being wrapped around.)

 

Copy this file to your PC and fill in each case in the switch statement with your code. Turn in your assignment to http://140.127.194.140. The deadline is midnight, Dec. 10, 2005. Do the programming on your own, do not cheat.