PRINT "Please enter the clothing price:" INPUT PRICE ' IF PRICE >= 100 THEN PRINT "The tax is:", PRICE * 0.05 ' true branch ELSE PRINT "There is no tax" ' false branch END IF ' END
>=
is the correct one.
If a user enters a price of 100 the program will print:
Please enter the clothing price: ? 100 The tax is:", 5
If a user enters a price of 50 the program will print:
Please enter the clothing price: ? 50 There is no tax
Remember that the true branch and the false branch of an IF-THEN-ELSE
can be any number of statements long.
Now think about how to modify the program so that the tax
and the total price for the item are printed out.
Here is the program, with new blanks:
PRINT "Please enter the clothing price:" INPUT PRICE ' IF PRICE >= 100 THEN PRINT "The tax is:", PRICE * 0.05 ' true branch PRINT "The Total is:", ______________ ' true branch ELSE PRINT "There is no tax" ' false branch PRINT "The Total is:", ______________ ' false branch END IF ' END
Complete the program by filling in the blanks. (Hint: pick a price of $150 and trace through the program to see that the correct statements are executed.)