< previous page page_935 next page >

Page 935
ologies together. Experienced programmers are familiar with both methodologies and use them either independently or in combination with each other. However, the software development community is becoming increasingly convinced that, although top-down design is important for designing low-level algorithms and operations on ADTs, the future in developing huge software systems lies in OOD and OOP.
Problem-Solving Case Study Time Card Lookup
0935-01.gif
Problem: In this chapter, we talked about a factory that is computerizing its employee time card information. Work on the software has already begun, and you have been hired to join the effort. Each morning after the employees have punched in, the time card data (ID number and time stamp) for all employees are written to a file named punchInFile. Your task is to write a program that inputs the data from this file and allows the user to look up the time stamp (punch-in time) for any employee. The program is to prompt the user for an ID number, look up that employee's time card information, and print it out. This interactive lookup process is repeated until the user types a negative number for the employee ID. The factory has, at most, 500 employees. If punchInFile contains more than 500 time cards, the excess time cards should be ignored and a warning message printed.
Input: Employee time card information (file punchInFile) and a sequence of employee ID numbers to be looked up (standard input device).
Each line in file punchInFile contains an employee's ID number (long integer) and the time he or she punched in (three integershours, minutes, and seconds):
246308 7 45 50
129336 8 15 29
The end-of-file condition signals the end of the input data.
Interactive input from the user consists of employee ID numbers, entered one at a time in response to a prompt. A negative ID number signals the end of the interactive input.
Output: For each employee ID that is input from the user, the corresponding time at which the employee punched in (or a message if the program cannot find a time card for the employee).
Below is a sample of the run-time dialogue. The user's input is highlighted.

 
< previous page page_935 next page >