Problem 3: 1B-3
Find an alternate landing time/location
The wind was less than 12 knots so Mary could safely land in Courtenay, but the wind conditions delayed their leave time and slowed down their travel so that their overall travel time was longer than expected. Mary will not make her booked landing time. Write an algorithm that will determine if there is a later landing time available in the Courtenay airfield. If not, she will have to default to Smits Field.
Solution (in English)
- Find the delay time and store it in a variable, “alternateTime”.
- Find the new leave time by adding “alternateTime” to the leave time, and store it in a vsriable, “newLeaveTime”.
- Find the new trip length by adding the alternate time to the “triplength”, and store it in a variable, “newTripLength”.
- Find the new landing time by adding “newTripLength” to the “newLeaveTime” and store it in a variable, “newLandingTime”.
- Check the next available landing time and store it in a variable, “nextlandingTime”.
- Compare the “nextlandingTime” and “newLandingTime”.
- If “newLandingTime” is earlier than “nextlandingTime”, make plans to land at Courtenay airfield
- If “newLandingTime” is later than “nextlandingTime”, to Smits Field.
Flow chart is given below: –
Leave a Reply