|
|
|
|
|
|
|
Get Data (Inout: dataFile; Out: deptID, deptSales) |
|
|
|
|
|
|
|
|
Read deptID from dataFile
IF EOF on dataFile
Return
Read numDays from dataFile
IF EOF on dataFile
Print Data error: No data following dept. ID.
Return
Set deptSales = 0.0
Set day (loop control variable) = 1
WHILE day <= numDays
Read sale from dataFile
IF EOF on dataFile
Print Data error: Ran out of data in mid-set.
Return
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 |
|
|
|
|
|
|
|
|
|
|
The module structure chart for the design has not changed. The following C++ program parallels our new design. |
|
|
|
|
|
|
|
|
//******************************************************************
// Graph program
// This program generates bar graphs of monthly sales
// by department for two Chippendale furniture stores, permitting
// department-by-department comparison of sales
//******************************************************************
#include <iostream.h>
#include <iomanip.h> // For setw()
|
|
|
|
|
|