What is the fare paid by someone who is 77 years old when the base fare is $100?
$75. When all of the conditions are false, then the last ELSE will have its branch execute.
The IF-ELSEIF
statement
can have several statements in each of its
branches.
Here is a version of the previous program that
shows this:
PRINT "Enter full fare" INPUT FARE PRINT "Enter age" INPUT AGE ' 'Calculate discount based on age IF AGE < 12 THEN PRINT "Children's fare" LET RATE = 0.0 ELSEIF AGE < 24 THEN PRINT "Student's fare" LET RATE = 0.70 ELSEIF AGE < 65 THEN LET RATE = 1.0 ELSE PRINT "Senior fare" LET RATE = 0.75 END IF 'Calculate fare PRINT "Your fare is:", FARE * RATE END
What will the program print for someone who is 8 years old when the base fare is $142?