Reading Time: < 1 minute

Problem 4. 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.

Solution (English)

  • Find out Their landing location. Store in a variable called landingLocation
  • Determine if it’s Courtenay
  • If Courtenay was the oputcome find out landing time and add 20 mins. Store it in a variable called LandingTime+20
  • If Courtenay was not the outcome find out landing time and add 45 mins. Store it in a variable called LandingTime + 45
  • Find out available times for reservations at Atlas Café. Store it in a variable called availableTime
  • If Courtenay was the landingLocation compare landingTime+20 to each availableTime
  • If availableTime < LandingTime+20 move to next availableTime
  • If availableTIme > LandingTime+20, book this time
  • If Courtenay was not the LandingLocation compare LandingTime+45 to each availableTime
  • If availableTime < LandingTime+45 move to next availableTime
  • If availableTIme > LandingTime+45, book this time