$\textstyle \parbox{1.5in}{CS1320}$ $\textstyle \parbox{3in}{\Large CS1320 Homework~8}$ $\textstyle \parbox{1.5in}{28~Oct 1999}$


Due Thursday, 04 Nov 1999, at the beginning of class.

Problem

When submitting a program, please submit a printed copy of the program's code prepended with comments briefly describing its input and output. Please indent your code to make it readable. See Section 2.5 of the textbook for style hints. If you desire, you can also submit examples demonstrating your program's correctness.






Ms. Ima Notta Late thought she had a cushy job at her local defense contractor. No matter how important her task, security closes the building at 11:59:59 pm every day so she never had to work into the early morning hours of the next day. Furthermore, she was writing programs for administrative tasks so she could avoid those moral questions about the importance of protecting our country versus helping kill people.

Her boss, Ms. Gotta Haveit Now, assigned her the task of computing the hours worked by each employee. Under pressure from the Pentagon to better document work hours, she gave Ms. Ima Late three days to write the program. Unfortunately, Ms. Ima Late did not use her middle name enough and failed to complete the task in time. Her boss fired her, but Ms. Late was able to erase her hard disk before she left.

In a bind, Ms. Gotta Haveit Now turns to you to complete the program. She explains that the program's input consists of a file of lines each listing the employee's Social Security number, starting time, and ending time (listed in military time, of course). The program's output should be stored in a file having each line list the Social Security number and the total hours, minutes, and seconds worked by that employee that day. She gives you yesterday's time sheet and the times she computed by hand as an example of your program's output.

Although Ms. Ima Late erased her hard disk, technical support was able to extract these code fragments from her hard disk. Since Ms. Late's program had already been approved by government inspectors (on temporary leave to the Pentagon from the Department of Energy public relations division) even though it was not yet finished (!!), Ms. Now requires you to use all the code fragments so she does not have to complete the bureaucratic paperwork again. Your deadline is Thursday, 04 Nov 1999 (in class).

As Ms. Now walks away from your cubicle, you hear her mutter, ``I hate reference variables. A mark of a good programmer is to use them only when necessary.'' Try to write your code in a way that will convince your new boss that you are a good programmer.

Hints

One of the easiest ways to subtract times is to convert hours, minutes, and seconds to seconds, subtract seconds, and then convert back to hours, minutes, and seconds. Apparently, this is what Ms. Ima Notta Late intended to do.

Be sure to use all the code given you or Ms. Now will dock points off your grade.




1999-10-27