A passenger is 21 years old and want a rount-trip ticket to Rome. The full fare is $1000. What does this passenger pay?

Answer:

The passenger gets the student discount, and pays $1000 * 0.70 = $700.

Sample Run of the Program

airfare flow chart

Here is how the program calculated the fare. The statements are numbered in the order that they executed:

(1) PRINT "Enter full fare"
(2) INPUT FARE          <-- $1000 
(3) PRINT "Enter age"
(4) INPUT AGE           <-- 21 
    '
    'Calculate discount based on age
(5) IF AGE < 12 THEN  <-- false
      LET RATE = 0.0

    ELSE

(6)   IF AGE  < 24 THEN  <-- true 
(7)     LET RATE = 0.70
      ELSE
        LET RATE = 1.0
      END IF

    END IF

    'Calculate fare
(8) PRINT "Your fare is:", FARE * RATE  <-- 1000 * 0.70 
(9) END

The first IF selected its false branch. That false branch contained another IF, which selected its true branch.

QUESTION 4:

If a passenger is under 12 what is RATE?