Does the car gets 10% rate?

Answer:

IF MILEAGE < 20000 THEN
 
  IF MILEAGE < 10000 THEN
    LET DISCOUNT = .1
  ELSE
    LET DISCOUNT = .05
  END IF

ELSE
  LET DISCOUNT = 0
END IF

Middle Discount Rate

nested task flow chart

Cars with mileage between 10000 and 20000 get the 5% discount rate. In the program, this happens when the first relational expression gives a value of true, and the second relational expression gives a value of false. Say, for example, that MILEAGE is 15000 miles.


        true
   ---------------
IF MILEAGE < 20000 THEN
 
          false
     ---------------
  IF MILEAGE < 10000 THEN
    LET DISCOUNT = .1  
  ELSE
    LET DISCOUNT = .05  <---- this statement
  END IF                      is executed

ELSE
  LET DISCOUNT = 0
END IF

The first true means that the true branch will execute. This true branch is a "little program" with its own control structure. That control structure selects its false branch to execute.

QUESTION 16:

Say that a car has 30000 annual miles. What will the discount be? (Try to get the answer by following the program.)