After the first three statements have executed, what happens with the program?
The loop part of the program starts up.
So now the program is about to start repeating the statements in the loop body. Memory looks like this:
|
|
Look at the looping part of the program:
' Retail price calculator ' with markup entered by the user PRINT "Enter the amount of markup in percent" INPUT MARKUP LET RATE = 1 + MARKUP / 100 DO PRINT "Enter wholesale price" ' ask the user for the wholesale price INPUT WHOLESALE ' get the price, put it in a variable PRINT "Retail price:", WHOLESALE * RATE ' compute and print out the retail price LOOP END
The loop works as it did in the previous program, except that now the multiplication involves two variables. Here is what the screen might look like:
Enter the amount of markup in percent ? 10 Enter wholesale price ? 100 Retail price: 110 Enter wholesale price ? 200 Retail price: 220 Enter wholesale price ? 50 Retail price 55 Enter wholesale price ?
As before, end the program by typing CONTROL-BREAK.
It might be nice to print out the RATE
used to multiply prices after
the user enters the MARKUP
.
Think of a PRINT
statement that will do this.
Where should it be placed in the above program?