CSCI 1300
Project: Calendar
This is one of several possible projects for CSCI 1300. The following
link tells how the projects are used:
What the Program Should Do
This program writes a calender for one month of any year between
1900 and 10000.
The month and year are inputs that are read from the user.
EXAMPLE OUTPUT
September 1994
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
- The program should print an error message if the input is invalid.
-
You'll find some useful information about formatting output
in http://www.cs.colorado.edu/~main/intro/projects/io.html.
-
Note: When a year is divisible by 100, then it is a leap year only if
it is also divisible by 400. For example, 2000 is a leap year, but 2100, 2200
and 2300 will not be leap years.
- Some useful functions for you to write in this program:
- A function to print a specified number of blanks (used at
the start, when printing the blanks at the front of the first week
of the month).
- A function to print a sequence of numbers from i to j, using
five spaces for each number. For example, the second week of the
sample calendar can be printed by calling print_sequence(4, 10);
- A function which calculates the day of the week for the
first day of any month in any year from 1900 to 10000.
The month number (1 to 12) and year number (1900 to 10000) are
parameters to this function. There are several clever ways to
compute this value, but the straight-forward way also works:
Compute the number of days from Jan 1, 1900 until the end of
the previous month; then take the remainder when this number is
divided by 7. A remainder of 0 indicates a Monday start for the month;
1 indicates Tuesday; 2 is Wednesday...
Estimated Difficulty Level for First Semester Students:
On a scale of 50 (easy) to 500 (hard): 200