Know Your Gas Hogs

Author(s): Mel Routt
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n9 (Volume 2, Issue 9)
Date: September 1981
Pages: 14

Use your ZX80 to compare fuel economies and estimate total gas expenditures. This program for 8K ROM, 1K RAM calculates yearly fuel costs for any two vehicles. You enter miles driven (actual or projected) per year, fuel price, and gas mileage per gallon. It returns the total fuel cost per year for each car.

  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
Syntactic Sum: 28144, 8K

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