Multiple Level Control Break Pseudocode
Multiple Level Control Break Pseudocode
Define Problems:
Input Process Output
Data Sales person: Print heading Heading
-Dept Get salesperson data Salesperson data
-ID Calculate line total Line total
-Quantity Calculate Sales total Sales total
-Unit Price Calculate Dept sales total Dept Sales Total
Calculate total all Total all
Outline solution
1. Main program
2. Init()
3. Heading()
4. Process()
5. Print_sales_total()
6. Print_dept_sales_total()
7. Reset_sales_total()
8. Reset_Dept_sales_total()
9. Print_report_total()
Main_Program()
1. Init()
2. Heading()
3. Read First Record
4. Curr_ID = ID
5. Prev_ID = ID
6. Curr_Dept = dept
7. Prev_Dept= dept
8. Do While Record Exist
9. If(curr_line > max_line)
Heading()
End if
10. If(Curr_ID!=Prev_ID)
Print_Sales_total()
Reset_Sales_Total()
End if
11. If(Curr_Dept!=Prev_Dept)
Print_Dept_Sales_Total()
Reset_Dept_Sales_Total()
12. end
13. Process()
14. Read next record
15. Curr_ID = ID
16. Curr_Dept = Dept
End Do
17. Print_report_total()
End
Init()
18. Line_no = 0
19. Sales_total =0
20. Report_total=0
21. Max_line_no = 30
End
Heading()
End
Process()
End
Print_Sales_total()
End
Print_dept_sales_total()
Reset_sales_total()
33. Sales_total = 0
End
Reset_dept_sales_total()
34. Dept_Sales_total = 0
End
Print_report_total()
End