
Given Wednesday, November 16, 2011
Due via ANGEL at 5pm on Wednesday, November 30, 2011
Modify the book's "improved cal" example (in UPE Chapter 5) to include the following features:
1. (20 points) Your cal should still include all the features of the version in the book.
2. (20 points) Your cal can correctly handle months with leading zeros (i.e. "cal 01" or "cal 01 2012).
3. (20 points) In "improved cal" command, when year is not provided in the command (i.e. "cal 02"), the current year is the default year. Allow your new cal to check if the month is passed in current year. If so, cal should print out the calendar of that month in the next year. for example, the current month is November, 2005, if you run "cal 01", you should print out the calendar of Jan. 2006.
4. (20 points) It is unlikely that anyone is really interested in getting a gregorian calendar for a year in the first century, a time when the gregorian calendar didn't even exist. Use the "windowing" strategy to allow your new cal to handle years that are not the full 4 digit year. If the year is in the range of 0 <= year <= 50, assume the year is really 2000-2050. If the year is in the range 51 <= year <= 99, assume the year is really 1951-1999. (The windowing strategy was a common work-around for Y2K problems.)
5. (20 points) all 4-digit years should be passed unchanged including 4 digit years that are less than 100 (i.e. we want to allow for people to say something like 0005, just in case they really do want a calendar for the year 5 A.D.).
Be sure to put comments in your code that explain where #2-5 above are implemented.