One of four cases will be picked. What control structure is good for this?
The IF ELSEIF
structure is a good choice.
Here is the program with some blanks for you to fill in:
'Calculate cost of fuel 'depending on grade and gallons PRINT "How many gallons" INPUT gallons PRINT "What grade (R, E, or S)" INPUT grade$ ' 'Calculate cost ' IF _________________ THEN PRINT "Cost is", 1.2 * gallons, "dollars" ELSEIF _________________ THEN PRINT "Cost is", 1.3 * gallons, "dollars" ELSEIF _________________ THEN PRINT "Cost is", 1.4 * gallons, "dollars" ELSE PRINT "You entered an incorrect grade" END IF END
Remember that regular costs $1.20, extra costs $1.30, and super costs $1.40.
Fill in the blanks so that the program is complete.