-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPAst paper prld Pseudocode coluour coded.txt
81 lines (45 loc) · 1.86 KB
/
PAst paper prld Pseudocode coluour coded.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
question
represent the pseudocode for the scenario below:
The sports administrators have decided to give something back to the community.
They have decided that if an individual purchases more than 10 tickets to the
event, they will give the customer 10% discount as well as donate R5000 to a local
charity.
The total amount due by the customer and confirmation of the donation needs to
be displayed on the screen.
If the customer purchases less than 10 tickets, the customer will be thanked for
their purchase.
All tickets will be sold at a flat rate of R70 per ticket.
start
//Declarations
num Input
num Discount = 0.10
num Price = 70
output "each ticket is R70, how many tickets would you like to buy "
input = Convert.ToInt32(ReadLine)
//call method checkTicketsBought
checkTicketsBought(input, Price)
/loop to see if they qualify for discount
if (input >= 10)
//call CalculateDiscount( PricePaid, Discount)
CalculateDiscount(PricePaid, Discount)
//call CalculateDiscount( PricePaid, discountedPrice)
CalculateDiscount( PricePaid, discountedPrice)
output " You qualify for a discount, your discounted amount was " + discountedPrice + " your final payment paid is " + FinalPrice
else
output "you have paid" + pricePaid + " thank you for your purchase have a nice day "
stop
checkTicketsBought(num input, Price)
Declarations
pricePaid
pricePaid = input * Price
return pricePaid
CalculateDiscount(PricePaid, Discount)
//Declarations
DiscountedPrice
discountedPrice = PricePaid - (PricePaid * Discount)
return discountedPrice
CalculateDiscount( PricePaid, discountedPrice)
Declarations
FinalPrice
FinalPrice = PricePaid - DiscountedPrice
return FinalPrice