Single level Control break Pseudocode
Define Problems:
Input Process Output
Data Sales person: Print heading Heading
-ID Get salesperson data Salesperson data
-Quantity Calculate line total Line total
-Unit Price Calculate Sales total Sales total
Calculate total all Total all
Outline solution
1. Main program
2. Init()
3. Heading()
4. Process()
5. Print_total()
6. Reset_control_total()
7. Print_report_total()
Main_Program()
1. Init()
2. Heading()
3. Read First Record
4. Curr_ID = ID
5. Prev_ID = ID
6. Do While Record Exist
7. If(curr_line > max_line)
Heading()
End if
8. If(Curr_ID!=Prev_ID)
Print_total()
Reset_Control_Total()
End if
9. Process()
10. Read next record
11. Curr_ID = ID
End Do
12. Print_report_total()
End
Init()
13. Line_no = 0
14. Sales_total =0
15. Report_total=0
16. Max_line_no = 30
End
Heading()
17. Print detail heading
18. Line_no = 6
End
Process()
19. Line_total = qty*price
20. Print detail record
21. Print line_total
22. Line_no++
23. Sales_total+=line_total
24. Total_all+=line_total
End
Print_total()
25. Print sales_total
End
Reset_control_total()
26. Sales_total = 0
End
Print_report_total()
27. Print total_all
End