PRINT "Please enter the clothing price:" INPUT PRICE ' IF PRICE >= 100 THEN LET TAX = PRICE * 0.05 ELSE LET TAX = 0 END IF ' PRINT "The tax is:", TAX PRINT "The total is:", PRICE + TAX END
The program might look somewhat odd to you because the
arithmetic expression PRICE + TAX
will sometimes add a zero to PRICE
.
This is fine.
It makes the program shorter and easier to understand if all the
PRINT
statements are at the end.
Sometimes a receipt from a grocery store shows a price of $0.00
for free items added into the total.
It is easier to do it that way than to do something special just
to avoid adding zero.
The user buys a shirt for $39.95. What will be printed on the monitor?