< previous page page_426 next page >

Page 426
Problem-Solving Case Study Comparison of Furniture-Store Sales, Part 2
0426-01.gif
Problem: In Chapter 7, we wrote the Graph program making some assumptions: each file is in order by department IDs, and the same departments are in each store. What if there are errors in the data files? We have not paid too much attention to data error checking (also called data validation) in our programs, yet errors do occur. Let's redo the design for the Graph program to add some data validation. There are no changes to the Input and Output specifications of the program, so we won't repeat them here.
Discussion: We'll begin by reviewing our old design for the Graph program.
Main                    Level 0
Open data files (and verify success)
Print heading
Get data for a Store 1 department
Get data for a Store 2 department
WHILE NOT EOF on file store1 AND NOT EOF on file store2
 Print data for the Store 1 department
 Print data for the Store 2 department
 Get data for a Store 1 department
 Get data for a Store 2 department

Print Heading (No parameters)                                                            Level 1
Print chart title
Print heading
Print bar graph scale

 
< previous page page_426 next page >