Homework 7 – Shell Scripting


Given Monday, October 28, 2019

Due Sunday, November 10 at 1159pm via BLACKBOARD

Modify the UPE book's "improved cal" example to include the following features; turn on one pdf with your code and sample screenshots of it running.

 1. (2 points) Your cal should still include all the features of the version in the book.

 2. (2 points) Your cal can correctly handle months with leading zeros (i.e. "cal 04" or "cal 04 2004).

 3. (2 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 April, 2004, if you run "cal 01", you should print out the calendar of Jan. 2005.  

 4. (2 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. (2 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 0004, just in case they really do want a calendar for the year 4 A.D.).