CS124, Fall 2010


Assignment #6

DUE: Thursday, November 4.


Write a program to output a calendar for a given month. The user is to specify a month (as a string with the name of the month in a capital letter, the rest in lowercase) and the day of the week on which that month starts (as a number from 1 to 7). A sample run of the program might be,
Please enter the month : May
Please enter the day of the week on which that month begins : 2
Here is the calendar for that month : 
                      May
Sun    Mon    Tue    Wed    Thu    Fri    Sat
        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
Note that the program "knows" that there are 31 days in May. The must be under no obligation to supply this information.

There are many ways such a program could be written. The more well-organized your program is in terms of objects and classes, the better. The highest grades will go to those that consist at least of the following two classes: When you go about coding these classes, remember the lesson of Lab 3:

BONUS PROBLEMS : Allow the user to specify if it's a leap year. Make Calendar capable of writing out the calendar for any user-specified number of months, given a starting month and starting day for that month as above. (These options, especially that last one, may require significant changes in the suggested implementation of the Month class above. Do not attempt this unless you have already done your best to implement the basic features.)

Submit electronically as usual.


Back to CS 124 Home Page