-
Notifications
You must be signed in to change notification settings - Fork 1
/
Pseudocode.txt
124 lines (98 loc) · 4.3 KB
/
Pseudocode.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
TASK 1
------------------------------------------------------------------------------------------------
ticket_type <- ["OneAdult","OneChild","Onesenior","FamilyTicket, "GroupTicket"]
one_day_booking_cost <- [20, 12, 16, 60, 15]
two_day_booking_cost <- [30, 18, 24, 90, 22.5]
extra_attraction <- ["Lionfeed", "Penguinfeed", "Barbecue(only 2 day ticket)"]
extra_attraction_cost <- [2.5, 2, 5]
days_of_the_week <- ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
choice <- []
extra_choice <- []
family_group <- 0
num_of_tickets <- 0
ticket_selected <- 0
booking_day <- 0
booking_ID <- 0
cost <- 0
extra_selected <- 0
count <- 0
For count = 1 To 5
PRINT ("Ticket type = ", ticket_type(count), ":", "Cost 1 Day="one_day_booking_cost(count),":", "Cost 2 day =", two_day_booking_cost(count))
Next count
PRINT ("Entra attraction optons are displayed below:")
For count = 1 To 3
PRINT ("Attraction", extra_attraction_cost(count), "=", extra_attraction(count))
Next count
TASK 2
------------------------------------------------------------------------------------------------
PRINT ("Do you want to buy tickets? Y/N ")
INPUT options
IF (options = "Y" or offer="y") THEN
PRINT ("Enter Ticket Catagory number: 1= OneAdult , 2 = OneChild, 3 = Onesenior 4 = Family Ticket, 5 = Group ticket")
INPUT ticket_selected
IF ticket_selected >1 OR <5 THEN
Print ("Enter a valid option")
ELSE
pass
PRINT ("Confirm booking for One day or Two days? 1 = one day, 2 = two days")
INPUT booking_day
PRINT ("Enter number of tickets")
INPUT num_of_tickets
WHILE booking_day =1 OR =2 AND num_of_tickets>0
booking_ID = booking_ID + 1 # This is for unique booking ID
IF booking_day = 1 THEN
cost = num_of_tickets * one_day_booking_cost(ticket_selected)
ELSEIF booking_day = 2 THEN
cost = num_of_tickets * two_day_booking_cost(ticket_selected)
End IF
PRINT("Your booking_ID for this booking is: " , booking_ID)
PRINT("Cost of ticket:",ticket_type[ticket_selected],"tickets=",num_of_tickets," Cost=",cost)
PRINT ("Do you want Extra attraction? Y/N")
INPUT extra_choice
IF extra_choice = Y THEN
PRINT ("Extra attraction num: 1= Lionfeed, 2= Penguinfeed, 3= Barbecue")
INPUT extra_selected
WHILE extra_selected =3 AND booking_day =1 # Validation check for BBQ which is only for 2 day tickets
PRINT ("Barbecue is available for two day tickets only, Input again")
INPUT extra_selected
END WHILE
cost = cost + extra_attraction_cost(extra_selected)
PRINT ("Cost of:",ticket_type[ticket_selected], "Num of tickets: ", numofticket, "+", extra_attraction[extra_selected], "Cost:", cost)
ELSE
PRINT ("Your ticket cost: ", ticket_type[ticket_selected], "Num of tickets: ", num_of_tickets, "No attraction"," Cost: ", cost)
END IF
END WHILE
ELSE
PRINT ("You chose to buy no tickets. Have a great day.")
END IF
TASK 3
------------------------------------------------------------------------------------------------
best_offer <- 0
IF TotalMember>=6 :
IF(VisitingDays=1) THEN
Groupcost=Totalmember()
ELSEIF(VistingDays=2)
Groupcost=Totalmember*22.50
PRINT(“Total Cost Calculation for tickets :”,TotalTicketcost)
PRINT("The Group cost is:",Groupcost)
IF( TotalTicketcost > Groupcost)THEN
PRINT ("Taking group ticket is the best offer")
offer=input("Do you want this offer Y/N")
IF (offer = "Y" or offer="y") THEN
TotalTicketcost=Groupcost
ELSE
PRINT ("Family ticket is the best offer")
END IF
END IF
END IF
IF best_offer > 0 THEN
PRINT ("Take BEST offer & save = ", cost - best_offer)
PRINT ("Best offer: ", best_offer, "For Best offer do a NEW Booking: Y/N, Do you want new booking? ")
INPUT choice
IF choice = Y THEN
GoTo Task 2
ELSE
PRINT ("Best offer not selected")
End IF
End IF
PRINT ("Ticket Type: ", ticket_type[ticket_selected]", Number: ", num_of_tickets, "Cost: ", cost)