eng
competition

Text Practice Mode

Pre-Release Material Pseudocode - Task 1

created Saturday May 14, 03:00 by Emma Narvaez


0


Rating

436 words
1 completed
00:00
Repeat = "yes"
WHILE Repeat == "yes"
IMPORT random
AvailableDays1 []
AvailableDays2 []
acb ["a", "c", "b"]
FinalCost 0
FamilyCounter 1
GroupCounter 1
NumAdultsFamily 0
NumSeniorsFamily 0
NumChildrenFamily 0
NumAdultsGroup 0
NumSeniorsGroup 0
NumChildrenGroup 0
YesOrNo ["Yes", "yes", "No", "no"]
BookingNumber random.randint(1000000000, 1999999999)
CurrencyFormat "${:,.2f}".format(FinalCost)
TicketDate ""
EveningBarbecueNum 0
IndividualFamilyPrice 0
CheaperAdultsNum 0
CheaperSeniorsNum 0
CheaperChildrenNum 0
CheaperFamilyNum 0
CheaperGroupNum 0
AllAdultsInGroup 0
AllSeniorsInGroup 0
AllChildrenInGroup 0
CheaperAllAdultsInGroup 0
CheaperAllChildrenInGroup 0
CheaperAllSeniorsInGroup 0
CheaperCost 0
Coupon 0
FUNCTION ErrorMessage()
  OUTPUT "Please re-enter a valid number"
ENDFUNCTION
FUNCTION NegNumMessage()
  OUTPUT "Please re-enter a positive number: "
ENDFUNCTION
FUNCTION YesOrNoMessage()
  OUTPUT "Please re-enter either 'yes' or 'no'."
ENDFUNCTION
OUTPUT "Hello! Welcome to Emmas’ Wildlife Park! \n Ticket Prices for One-Day Tickets: \n Adult - $20.00 \n Child (an adult may bring up two children) - $12.00 \n Senior - $16.00 \n Family - $60.00 \n Group (six people or more, price per person) - $15.00 \n Ticket Prices for Two-Day Tickets: \n Adult - $30.00 \n Child (an adult may bring up two children) - $18.00 \n Senior - $24.00 \n Family - $90.00 \n Group (six people or more, price per person) - $25.50 \n Extra Attractions for One-Day Tickets: \n Lion Feeding - $2.50 \n Penguin Feeding - $2.00 \n Extra Attractions for Two-Day Tickets: \n Lion Feeding - $2.50 \n Penguin Feeding - $2.00 \n Evening Barbecue - $5.00"  
IMPORT date, timedelta
CurrentDate date.today()
OUTPUT "Available Days for Booking One-Day Tickets: \n"
FOR x 1 TO 8  
  OUTPUT CurrentDate + timedelta(x)
  AvailableDays1.Append(timedelta(x))  
NEXT x
OUTPUT "Available Days for Booking Two-Day Tickets: \n"
FOR x 1 TO 7  
  OUTPUT CurrentDate + timedelta(x)
  AvailableDays2.Append(timedelta(x))  
NEXT x
Valid = False
WHILE not Valid
  OUTPUT "How many days do you want to come to the zoo?"
  INPUT NumDays
  IF NumDays < 1 THEN
    Valid = False
    NegNumMessage()
  ENDIF
  IF ValueError THEN
    Valid = False
    ErrorMessage()
  ENDIF
  IF NumDays > 2 THEN
    Valid = False
    OUTPUT "You may only come to the zoo for up to two consecutive days. Please re-enter."
  ENDIF
ENDWHILE
WHILE True  
  OUTPUT "What day would you like to use these tickets on? (YYYY-MM-DD)"
  INPUT TicketDate
  IF NumDays == 1 THEN
    IF TicketDate not in AvailableDays1 THEN  
      OUTPUT "Please re-enter a date listed above for one-day tickets"
    ENDIF
  ENDIF
  IF NumDays = 2 THEN
    IF TicketDate not in AvailableDays2 THEN
      OUTPUT "Please re-enter a date listed above for two-day tickets"
    ENDIF
  ENDIF
ENDWHILE  
 

saving score / loading statistics ...