122 homework week 3


The assignment

Project Requirements

  1. Read the problem description and high-level solution given on pp. 82-85. Then use Emacs to edit/compile/execute a C++ program, months.cpp, that meets the i/o specification given on p. 83.

  2. Test your program for correctness by running it on values in your Test Oracle (a.k.a. Test Set pg. 85.) Include a set of test cases as described on p. 85. The test set of a minimum of 18 test cases will be stored in a file named months.in. You may do initial testing with manual entry, but should move to the input file as you get close to a solution.

  3. When the program is tested and correct use Unix I/O redirection to run your program on months.in, and create an output file, months.out. I/O redirection is described on the Unix I/O redirection web page.

  4. Turn in should include your source code, months.in and months.out. You will be marked down if your test set does not include all the cases discussed in the book. (If you're not sure why all are needed, we should talk. You will have to generate your own test cases as time goes on.)

I/O specification

Your program should generate this interface (see p. 83):
How many months? 3
Enter month 1: 13
13 is not a valid month
Enter month 2: 1
Month = 1. There are 31 days in January.
Enter month 3: 2
Month = 2. For February, also enter the year: 1998
Year = 1998. There are 28 days in February.
          
Exiting...