' Retail price calculator ' with markup entered by the user ' for each item. ' Greeting message and blank lines added. PRINT "Welcome to the retail price calculator." DO PRINT "Enter the amount of markup in percent" INPUT MARKUP LET RATE = 1 + MARKUP / 100 PRINT "The price multiplier is:", RATE 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 PRINT ' print blank line LOOP END
The greeting is printed just once. The blank line is printed for each item, just after the retail price is printed. The output of the program now is:
Welcome to the retail price calculator. Enter the amount of markup in percent ? 50 The price multiplier is: 1.50 Enter wholesale price ? 100 Retail price: 150 Enter the amount of markup in percent ? 15 The price multiplier is: 1.15 Enter wholesale price ? 100 Retail price: 115 Enter the amount of markup in percent ? 10 The price multiplier is: 1.1 Enter wholesale price ? 100 Retail price: 110 Enter the amount of markup in percent ?
Its time for you to write some loops on your own. Let us first review by writing a simple program.
Write a program that writes "Hello World" on the monitor screen again and again without end (until you hit CONTROL-BREAK).