Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Task 1

Declare Array TicketType[1:5] as string


Declare Array OneDayCost[1:5] as real
Declare Array TwoDayCost[1:5] as real
Declare Array ExtraAttraction[1:3] as string
Declare Array ExtraAttractionCost[1:3] as real
Date=0 Day=0 BookingStartDay=0 BookingEndDay=0
StartDay=0 EndDay=0 DayType=0
Declare Array Date[1:8] as real

TicketType["Adult", "Children(2 per adult)", "Senior", "Family", "6 or more


(cost per person )"]
OneDayCost["20", "12", "16", "60", "15"]
TwoDayCost["30", "18", "24", "90", "22.5”]
ExtraAttraction["Lion Feeding", "Penguin Feeding", "Evening Barbeque(2 day
only)"]
ExtraAttractionCost["2.5", "2", "5"]

Print “Ticket Type Cost For one day($) Cost for two days($)”
For x= 1 to 5
Print TicketType[x]
Print OneDayCost[x]
Print TwoDayCost[x]
Next x

Print “Extra Attraction Cost Per Person($)”


For x= 1 to 3
Print ExtraAttraction[x]
Print ExtraAttractionCost[x]
Next x

Repeat
Print “Enter Today's Day”
Input Day
Until Day>0 and Day<=31
Print “Days available for booking are”
StartDay=Day
FOR j = 1 TO 7
IF day = 31
day = 0
ENDIF
day = day + 1
PRINT(day)
NEXT j
EndDay=Day
Repeat
Print “Enter a valid booking day (upto 2 days only)”
Input BookingStartDay
Input BookingEndDay
Until BookingStartDay>=StartDay and BookingEndDay<=EndDay and
BookingStartDay-BookingEndDay<=1 and BookingEndDay-BookingStartDay>=0
If BookingStartDay-BookingEndDay=0 then
DayType=1
If BookingStartDay-BookingEndDay=1 then
DayType=2

Task 2
DayType=0 UniqueNum=1000 Option1=“” Option2=“” Option3=””
Option4=“” Option5=“” AdultNum=0 ChildNum=0 SeniorNum=0 GroupNum=0
TotalPpl=0 Cost=0 TicketType=0
Repeat
Print “Would you like to buy a one day ticket or 2 day- Enter
1 for one day and 2 for 2 days”
Input DayType
Until Daytype=1 or Daytype=2
Repeat
Print”If you want an adult Ticket type press 1, child ticket
Child ticket press 2, senior ticket press 3, family
Ticket press 4 and group ticket press 5
Input TicketType
If TicketType=1 then
Print “How many adults”
Input AdultNum
End if
If TicketType=2 then
Repeat
Print “one adult may bring up to 2 children”
Input AdultNum #if not previously entered-0
Input ChildNum
Until ChildNum/AdultNum <=2
End If
If TicketType=3 then
Print “How many seniors”
Input SeniorNum
End If
If TicketType=4 then
Repeat
Print “this ticket is applicable for 2 senior/adult
and 3 children, do you wish to purchase it, yes
or no”
Input Option 1
Until Option 1 = yes or Option 1 = no
End If
If TicketType=5 then
Repeat
Print “How many members wish to go (6 or more) type
0 to exit”
Input GroupNum
Until GroupNum>=6 or GroupNum=0
If GroupNum>=6 then Option2=yes
Print “Do you wish to purchase more tickets, yes or no”
Input Option 3
Until Option 3 = no
If DayType=1 then
Cost= AdultNum*20+ChildNum*12+ SeniorNum*16
If Option1 = yes then
Cost=Cost+60
Else If Option2= yes then
Cost=Cost + GroupNum*15
End If

Else
Cost= AdultNum*30 + ChildNum*18 + SeniorNum*24
If Option1= yes then
Cost= Cost+90
Else If Option 2 = yes then
Cost= Cost + GroupNum*22.5
End If
Repeat
Print “Would you like to buy Extra attractions, yes or no”
Input Option 4
If Option 4= yes then
If DayType = 1 then
Print “Would you like to purchase lion feeding or
Penguin Feeding, enter 1 or 2”
Input Extra
If DayType=2 then
Print “Would you like to purchase lion feeding
Penguin Feeding or evening barbecue,enter 1,2 or 3”
Input Extra
If Extra= 1 then
Print “Enter total number of people”
Input TotalPpl
ExtraCost= TotalPpl*2.5
If Extra=2 then
Print “Enter total number of people”
Input TotalPpl
ExtraCost=TotalPpl*2
If Extra=3 then
Print “Enter total number of people”
Input TotalPpl
ExtraCost= TotalPpl*5
End If
Print “Would you like to purchase more, yes or no”
Input Option5
Until Option5 = no
UniqueNum= UniqueNum+1
TotalCost=ExtraCost+Cost
Print “You cost is”, Cost
Print “Extra attractions cost is”, ExtraCost
Print “Your cumulative total is,” TotalCost
Print “Your booking number is”, UniqueNum

Task 3
Repeat
AdultNum = Input("Enter the number of Adults visiting")
ChildNum = Input("Enter the number of Children visiting")
SeniorNum = Input("Enter the number of Seniors visiting")
OldNum = AdultNum + SeniorNum
TotalNum = ChildrenNum + OldNum
Until ChildrenNum/AdultNum <= 2
If ChildNum/OldNum =1.5 and TotalNum Mod 5 = 0 then
If DayType=1 then
NewCost= (TotalNum/5)*60
Individual Cost= AdultNum*20+ChildNum*12+ SeniorNum*16
If NewCost<=IndividualCost then
Print “We can reduce your cost with family ticket”
Cost= NewCost
ELse
Print “Individual Price is cheapest”
Cost=Individual Cost

Else
Newcost= (TotalNum/5)*90
IndividualPrice=AdultNum*30 + ChildNum*18 + SeniorNum*24
If NewCost<=IndividualCost then
Print “We can reduce your cost with family ticket”
Cost= NewCost
ELse
Print “Individual Price is cheapest”
Cost=Individual Cost
End If
End If
Else If TotalNum>=6 then
If DayType=1 then
NewCost= TotalNum*15
Individual Cost= AdultNum*20+ChildNum*12+ SeniorNum*16
If NewCost<=Cost then
Print “Group Ticket is cheaper”
Cost=Newcost
ELse
Print “Individual Price is cheapest”
Cost=Individual Cost
Else
NewCost=TotalNum*22.5
IndividualPrice=AdultNum*30 + ChildNum*18 + SeniorNum*24
If NewCost<=Cost then
Print “We can reduce your cost with family ticket”
Cost= NewCost
ELse
Print “Individual Price is cheapest”
Cost=Individual Cost
EndIf
End If
EndIf
Print “Total cost is” Cost+ExtraCost ¡

You might also like