People that are at least 24 years old but less than 30 years old get a preferred fare with a RATE of 80% of full fare.

Answer:

The new part of the program will look like this:

 
ELSEIF AGE  < 30 THEN
  PRINT "Preferred rate"
  LET RATE = 0.80

(Look at the complete program to see that only those persons at least 24 years old get this rate.)

Checking the Program

airfare flow chart

Here is where it fits into the complete program:

 
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  < 30 THEN
  PRINT "Preferred rate"
  LET RATE = 0.80

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

The new lines fit well into the old program. Usually this is not the case, and you have to modify several lines of the old program. You should be careful that the new version works correctly by checking its output with several values of input data.

QUESTION 16:

Check the program. Does a 28 year old person get the preferred rate (as they should)?