The over-all logic of the program is the same, but some of the details have changes:
PRINT "Number of Copies", "Price"
FOR COPIES = 1 TO 50
' per copy price calculation
IF COPIES >= 6 THEN
LET PERCOPY = 0.15
ELSE
LET PERCOPY = 0.07
END IF
' print a line of the table
PRINT COPIES, COPIES * PERCOPY
NEXT COPIES
'
END
There are other ways to write the program, as well. Here is a skeleton of a program that uses two counting loops one after another. The first loop calculates the price for one through five copies; then the second loop calculates the price for six through fifty copies.
PRINT "Number of Copies", "Price"
' Write out table for copies one through five
FOR COPIES = 1 TO 5
' print a line of the table
PRINT COPIES, COPIES * 0.15
NEXT COPIES
' Write out table for copies six through fifty
FOR COPIES = 6 TO 50
' print a line of the table
PRINT COPIES, COPIES * 0.07
NEXT COPIES
'
END
All three programs print out the same table. The user would not be able to tell the difference just by looking at the output.
Which version of the program is better?