Computer Science: Ticket Sales Program - IPO, Pseudocode, and Tracing

Verified

Added on  2019/09/24

|5
|547
|358
Homework Assignment
AI Summary
This assignment solution details a ticket sales program, addressing various aspects of software development. It begins with variable definitions, including constants for ticket prices and variables for ticket categories. The solution outlines the program's IPO (Input, Process, Output), pseudocode, and a module hierarchy to illustrate the program's structure. The pseudocode describes the main module, which calls modules to set ticket quantities and calculate the total amount generated. A flowchart visually represents the program's logic. The solution also includes a hand-tracing section, demonstrating the program's execution with sample data, showing the values of variables at each step and the corresponding output, to facilitate understanding of the program's behavior and the impact of different inputs on the final output. The problem covers fundamental programming concepts and provides a comprehensive guide to understanding and implementing a ticket sales program.
Document Page
Problem 1
Variables
INTEGER CONSTANT PRICECATEGORY1 = 250
INTEGER CONSTANT PRICECATEGORY2 = 200
INTEGER CONSTANT PRICECATEGORY3 = 150
INTEGER TICKETCATEGORY1 = 0
INTEGER TICKETCATEGORY2 = 0
INTEGER TICKETCATEGORY3 = 0
INTEGER AMOUNTGENERATED
IPO
Input(s) Process(es) Output(s)
ticketCategory1
ticketCategory2
ticketCategory3
amountGenerated =
(priceCategory1*ticketCategory1)
+
(priceCategory2*ticketCategory2)
+
(priceCategory3*ticketCategory3)
amountGenerated
Pseudocode
Start
1. Define global constant Integer priceCategory1 = 250
2. Define global constant Integer priceCategory2 = 200
3. Define global constant Integer priceCategory3 = 150
4. Define global Integer ticketCategory1 = 0
5. Define global Integer ticketCategory2 = 0
6. Define global Integer ticketCategory3 = 0
7.
8. Module main()
9. Call setSeats()
10. Call getAmount()
11. End Module
12.
13. Module setSeats()
14. Set ticketCategory1=quantity(“Number of tickets sold of category 1“)
15.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
16. Set ticketCategory2=quantity(“Number of tickets sold of category 2“)
17. Set ticketCategory3=quantity(“Number of tickets sold of category 3“)
18. End Module
19.
20. Module getAmount ()
21. Set amountGenerated = (priceCategory1*ticketCategory1) +
(priceCategory2*ticketCategory2) + (priceCategory3*ticketCategory3)
22. Display “Total income generated”,amountGenerated
23. End Module
End
Document Page
IPO Flowchart
Call setSeats()
GLOBAL VARIABLES
Define global constant Integer priceCategory1 = 250
Define global constant Integer priceCategory2 = 200
Define global constant Integer priceCategory3 = 150
Define global Integer ticketCategory1 = 0
Define global Integer ticketCategory2 = 0
Define global Integer ticketCategory3 = 0
Call getAmount()
setSeats ()
End
Return monthlycost
main()
Set ticketCategory1=quantity(“Number
of tickets sold of category 1“)
Set ticketCategory1=quantity(“Number
of tickets sold of category 1“)
Set ticketCategory1=quantity(“Number
of tickets sold of category 1“)
getAmount ()
Set amountGenerated =
(priceCategory1*ticketCategory1) +
(priceCategory2*ticketCategory2) +
(priceCategory3*ticketCategory3)
End
End
Document Page
Module Hierarchy
Hand Tracing
Trace your program with the following data samples:
ticketCategory1: 25
ticketCategory2: 50
ticketCategory3: 100
Variables
ticketCategory1 ticketCategory2 ticketCategory3 ammount
Generated
Line
#s
Output
1
2
3
4
5
6
7
8
9
main()
setSeats () getAmount ()
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10
11
12
13
14 Number of
tickets sold of
category 1
15 25 Number of
tickets sold of
category 2
16 25 50 100 Number of
tickets sold of
category 3
17 25 50 100
18 25 50 100
19 25 50 100
20 25 50 100
21 25 50 100
22 25 50 100 Total income
generated
23 25 50 100 31250
chevron_up_icon
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]