0204

Problem 4: Book a dinner reservation

While Mary is figuring out which airfield to land in, Louise needs to book a reservation at the Atlas Cafe. She was given a list of open times for the reservation. Based on the place they land, she needs to add 20 minutes (Courtenay) or 45 minutes (Smits Field) to their landing time to determine the reservation time. She also needs to book either a taxi (Courtenay) or the airfield loaner car (Smits Field). Write an algorithm that will take the necessary outputs from Problem 3 and determine which reservation time and mode of transportation she needs to book.Ā  (You do not need to duplicate 3, just start 4 as if adding on to 3)

Solution (English)

  • Would need to ā€œrecordā€ (put into memory) result of Problem number 3, create a var ā€œfieldArrivalā€
  • If result was NO (Smits Field), store ā€˜falseā€™ in var ā€œfieldArrivalā€
  • If result was YES (Courtenay), store ā€˜true in var ā€œfieldArrivalā€
  • If value is ā€˜trueā€™, var ā€œtimeAddā€ equals ā€˜20ā€™ & var ā€œtravelVehicleā€ equals ā€˜Taxiā€™
  • If value is ā€˜falseā€™, var ā€œtimeAddā€ equals ā€˜45ā€™ & var ā€œtravelVehicleā€ equals ā€˜Loaner Carā€™
  • Output (Add ā€œtimeAddā€ minutes for reservation and call a ā€œtravelVehicleā€ for pick-up.)

Solution (flowchart)

← Previous Post

Next Post →

Leave a Reply