< previous page page_952 next page >

Page 952
The Driver: The final step in OOD is to design the driverthe top-level algorithm. As is usually the case in OOD, the driver has very little to do but coordinate the objects that have already been designed.
Main                                                                                Level 0
Create empty list of time cards named punchInList
Open punchInFile for input and verify success
punchInList.ReadAll(punchInFile)
punchInList.SelSort()

Get idNum from user
WHILE idNum >0
   punchInList.BinSearch(idNum, punchInCard, found)
   IF found
      punchInCard.Print()
   ELSE
      Print idNum,  has not punched in yet.
   Get idNum from user

Get ID (Out: idNum)                                                                               Level 1
Print blank line
Prompt user for an ID number
Read idNum

0952-01.gif
On the next page is the PunchIn program showing the implementation of the driver. We use
#include timecard.h

 
< previous page page_952 next page >