This 8K/2K program calculates the unit price of two similar products. To run the program, just follow the directions remembering that units are ounces, grams, etc. If you want to exit the program early, enter XX.
The idea for this program came from William Scott Watson’s book entitled 67 Ready-To-Run Programs In Basic, written for TRS-80 Level 1 BASIC. Offered by Tab Books Inc. of Blue Ridge Summit PA., ($12.95) it contains programs in the graphic, home, business, education and games areas. In addition to the programs it offers, I found it to be a very good resource book and I recommend it to any ZX/TS user.
5 REM UP
10 PRINT "THIS PROGRAM COMPARES PRODUCTS A AND B BASED ON UNIT PRICE"
84 LET A$="FIRST PRODUCT"
25 PRINT
30 PRINT "HOW MUCH DOES ";A$;" COST"
35 INPUT A
36 PRINT
37 PRINT "HOW MANY UNITS IN PRODCT A"
40 INPUT B
50 LET B$="SECOND PRODUCT"
52 PRINT
55 PRINT "HOW MUCH DOES ";B$;" COST"
60 INPUT C
62 PRINT
65 PRINT "HOW MANY UNITS IN PRODUCT B"
70 INPUT D
80 CLS
90 LET E=A/B
100 LET F=C/D
110 LET E=E*100
120 LET F=F*100
130 PRINT A$;"=";E;" CENTS PER UNIT"
135 PRINT
140 PRINT B$;"=";F;" CENTS PER UNIT"
4241 PRINT
150 IF E<F THEN GOTO 300
160 IF E=F THEN GOTO 400
170 PRINT B$;" IS A BETTER ?UY ACCORDING TO UNIT PRICE"
175 GOTO 450
300 PRINT A$;" IS A BETTER BUY ACCORDING TO UNIT PRICE"
400 PRINT "BOTH PRODUCTS EQUALLY PRICED"
450 STOP
SYNTACTIC SUM: 33047, 8K
Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.