Know Your Gas Hogs

Developer(s): Mel Routt
Date: 1981
Type: Program
Platform(s): ZX81, TS 1000
Tags: Home

Answer MILES =, PRICE/GAL =, VEH 1 MPG = and VEH 2 MPH = (a printed typo for MPG). The program prints how many gallons each vehicle would use for those miles and what the fuel would cost, so you can see which one is the gas hog.

It was written for the 8K ROM in 1K. Line 140 has no matching LET after its GOSUB, so the second vehicle’s cost is printed without the rounding the first one gets.

Published in Syntax September 1981 (Know Your Gas Hogs).

Related Articles

Use your ZX80 to compare fuel economies and estimate total gas expenditures.

Image Gallery

Source Code

  10 PRINT "MILES = ";
  15 INPUT M
  20 PRINT M
  25 PRINT "PRICE/GAL = ";
  30 INPUT P
  35 PRINT P
  40 PRINT "VEH 1 MPG = ";
  45 INPUT V1MPG
  50 PRINT V1MPG
  55 PRINT "VEH 2 MPH = ";
  60 INPUT V2MPG
  65 PRINT V2MPG
  70 LET V1G=M/V1MPG
  75 LET X=V1G
  80 GOSUB 500
  85 LET V1G=X
  90 LET V2G=M/V2MPG
  95 LET X=V2G
 100 GOSUB 500
 105 LET V2G=X
 110 LET V1D=V1G*P
 115 LET X=V1D
 120 GOSUB 500
 125 LET V1D=X
 130 LET V2D=V2G*P
 135 LET X=V2D
 140 GOSUB 500
 150 PRINT
 155 PRINT "VEH:   GAL:   COST:"
 160 PRINT
 165 PRINT " 1     ";V1G;"  $ ";V1D
 170 PRINT
 175 PRINT " 2     ";V2G;"  $ ";V2D
 180 STOP
 500 LET X=(INT (100*(X+.005)))/100
 505 RETURN

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