Unit Pricer

Developer(s): Stephen Zachev
Date: 1982
Type: Program
Platform(s): ZX81, TS 1000
Tags: Home

Enter the cost of the first product and its number of units, then the same for the second. The program prints the cost per unit of each in cents and says which product is the better buy.

As printed, two line numbers are misprinted (84 for 20 and 4241 for 145), and when the products are equally priced the program goes on to print the wrong message too. The November 1982 Syntax Errors column corrected the line numbers and added 350 STOP. The download has the program as printed and corrected. Line 170 prints ?UY for BUY, as printed. The heading says 8K ROM, 2K RAM.

Published in Syntax October 1982 (Unit Pricer).

Related Articles

Program calculates the unit price of two similar products.

Related Content

Image Gallery

Source Code

   5 REM UP
  10 PRINT "THIS PROGRAM COMPARES PRODUCTS A AND B BASED ON UNIT PRICE"
  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
  84 LET A$="FIRST PRODUCT"
  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"
 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
4241 PRINT

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.