< previous page page_365 next page >

Page 365
Get Data (Inout: dataFile; Out: deptID, deptSales)
Read deptID from dataFile
IF EOF on dataFile
Return
Read numDays from dataFile
Set deptSales = 0.0
Set day (loop control variable) = 1
WHILE day 
 numDays
Read sale from dataFile
Add sale to deptSales
Increment day

Print Data (In: deptID, storeNum, deptSales)
Print deptID
Print storeNum
WHILE deptSales > 250.0
Print a 
*
Subtract 500.0 from deptSales
Terminate current output line

To develop this top-down design, we had to make several passes through the design process, and several mistakes had to be fixed to arrive at the design you see here. Don't get discouraged if you don't have a perfect topdown design on the first try every time.
Module Structure Chart:
Because we are expressing our modules as C++ functions, the module structure chart now includes the names of parameters and uses arrows to show the direction of data flow.

 
< previous page page_365 next page >