First Assignment, due 24th September 2002

and Second Assignment, due 1st October 2002

Electronic Submission, hw1, hw2

 
Using HTML and the CGI interface, write a C++ program that takes a date (year, month, day) and an increment (positive or negative number of days), and calculates the date that is the given number of days after the given date.

For a demonstration of how the program should behave, look here.

For almost full marks on the first turn-in, you only need to make it work for dates in this calendar year (2002). For completely full marks, and for the second turn-in, it should work for any date from 14th September 1752 to 31st December 2999.

For a bit of extra credit, make it also calculate the day of the week for both dates, like the example does.

Note: 14th September 1752 is when we changed from the Julian calendar to the Gregorian Calendar. As a result of the change, Wednesday 2nd September 1752 was immediately followed by Thursday 14th September 1752. Under the Julian calendar, every year whose number is divisible by 4 is a leap year. Under the Gregorian calendar, the rule is the same except that century years (e.g. 1900, 2000, 2100) are only leap years if divisible by 400.

For extra extra credit, make your program work smoothly for all dates from 1st January 1 to 21st December 9999.


To help with testing, here is a calendar constructor (which only works for the Gregorian calendar).