Multiple Level Control Break Pseudocode

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

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()

22. Print detail heading


23. Line_no = 6

End

Process()

24. Line_total = qty*price


25. Print detail record
26. Print line_total
27. Line_no++
28. Sales_total+=line_total
29. Dept_Sales_total+=line_total
30. Total_all+=line_total

End

Print_Sales_total()

31. Print sales_total

End

Print_dept_sales_total()

32. Print Dept_sales_total


end

Reset_sales_total()

33. Sales_total = 0

End

Reset_dept_sales_total()

34. Dept_Sales_total = 0

End

Print_report_total()

35. Print total_all

End

You might also like