What control structure do you think will be used to pick one of three choices?
Nested IFs.
The part of the program described as
Figure out the DISCOUNT
will be written as nested IFs. There are several ways in which this can be done. Here is one plan:
(There are several other plans that will work, but let's use this one.) Using this plan, the program will look something like this:
PRINT "Please enter the base rate" INPUT BASERATE PRINT "Please enter annual mileage" INPUT MILEAGE IF the car gets a discount THEN Decide between 5% and 10% discount ELSE LET DISCOUNT = 0.0 ' no discount for high mileage cars END IF PRINT "Your base rate is", BASERATE PRINT "Your discount is", DISCOUNT PRINT "You pay", BASERATE * (1 - DISCOUNT) END
Replace the description "the car gets a discount" with a relational expression that tests if the mileage is low enough for a discount. Cars with LESS THAN 20000 annual miles qualify for a discount.