Solution (in English):
- Find out (input) how long the trip will take from take off to landing. Store it in a variable called ‘tripLength’
- Find out when Mary and Louise are able to leave. Store it in a variable called ‘leaveTime’
- Calculate ’leaveTime’ plus ’tripLength’. Store it in a variable called ‘earliestLandingTime’
- Find out how much extra time Mary and Louise are going to take. Store it in a variable called ’extraTime’
- Calculate ’earliestLandingTime’ plus ’extraTime’. Store it in a variable called ’newLandingTime’
- Find out the available landing times. Store it in a variable called ‘availableTimes’
- Compare ’newLandingTime’ to each ’availableTimes’
- If ’availableTime’ is earlier than ’newLandingTime’, move to the next ’availableTime’
- If there is ’availableTime’ that match ’newLandingTime’, land in Courtenay
- If there is no ’availableTime’ that match with ’newLandingTime’, default to Smits Field
Flowchart:

Leave a Reply