8-Bit Software Online Conversion

Miles Per Gallon - Listing

10REM MPG&Lp100Km Calculator 20REM By W.E.Jowitt 30MODE1 40 *FX16 50 a=0 60 del$=STRING$(33," ") 70DIM mpg(10),d(10),m(10),y(10) 80 h$=CHR$(17)+CHR$(129)+" * Petrol C onsumption *"+CHR$(17)+CHR$(128) 90PRINT'SPC(6)h$' 100PRINT'"Quantity entered taken as li tres"'" unless gallons (G/g) entered." 110REM LOAD mpgs 120COLOUR 2 130PRINT'"Load previous MPG file?"; 140IF INSTR("Yy",GET$)GOTO 160 ELSE PR INT'"Car Registration Number " 150PROCINPUT(7):GOTO310 160MODE 6 170PRINT''"Car Registration Number":PR OCINPUT(7) 180file=OPENIN C$ 190FOR i=1 TO 10 200INPUT #file,mpg(i) 210INPUT #file,d(i) 220INPUT #file,m(i) 230INPUT #file,y(i) 240NEXT 250INPUT #file,b 260CLOSE #file 270a=b 280MODE 1 290PRINT'SPC(6)h$' 300REM New mpg 310COLOUR 3 320PRINT'"Calculate new MPG (Y/N)?" 330IF INSTR("Yy",GET$) ELSE 670 340FOR i=10 TO 2 STEP -1 350mpg(i)=mpg(i-1) 360m(i)=m(i-1) 370d(i)=d(i-1) 380y(i)=y(i-1) 390NEXT 400IF a=0 THENINPUT'"Milage at previou s fill? "a:GOTO420 410PRINT'"Milage at previous fill ";a 420INPUT'"Milage at this fill up ? "b 430 PRINT 440INPUT"Date of fill (day no.) ? "d 450IF d>31 THEN VDU11:PRINTdel$:VDU11: GOTO440 460PRINT 470INPUT"Month (month no.) ? "m 480IF m>12 THEN VDU11:PRINTdel$:VDU11: GOTO470 490INPUT'"Year ? 19"y 500IF a>b THEN b=b+1000 510k=b-a 520PRINT'"Miles since last fill ";k 530INPUT'"How much petrol filled ? "p$ 540@%=&20205 550p=VALp$ 560IF (ASC(RIGHT$(p$,1))OR 32)=ASC"g"T HEN 570 ELSE p=p/4.546 570mpg(1)= (k/p) 580d(1)=d 590m(1)=m 600y(1)=y 610COLOUR 2 620 PRINT'" MPG = ";mpg(i);" L/100Km = ";282.47/mpg(i) 630@%=&00000:@%=&00304 640COLOUR 1 650PRINT'"Hit a key..."; 660G%=GET 670REM Bar chart 680CLS:COLOUR 2 690 PRINT'''TAB(4)h$;CHR$(17)+CHR$(12 9)+" "+C$+" * "+CHR$(17)+CHR$(128) 700PRINT'"MPG L/100Km";TAB(27)"L/100Km ";TAB(36)"MPG" 710@%=&20204 720PRINT " " 730FOR i=1 TO 10 740IF mpg(i)=0 THEN 770 750PRINTTAB(29);282.47/mpg(i);TAB(35); mpg(i) 760NEXT 770x=12 780 VDU29,120;200; 790@%=&00000:@%=&00304 800FOR j=20 TO 40 STEP 2 810MOVE 0,x*j:PLOT21,800,x*j 820NEXT 830GCOL0,1 840FOR h=5 TO 50 STEP 5 850MOVE 0,x*h:PLOT21,800,x*h 860NEXT 870PRINTTAB(0,27)"DATE" 880PRINTTAB(0,28)"MONTH" 890PRINTTAB(0,29)"YEAR" 900COLOUR 3 910FOR i=1 TO 10 920IF mpg(i) ELSE 970 930GCOL 1,1 940 MOVE 72*i,x*mpg(i):MOVE 72*i+64,x* mpg(i):PLOT 85,72*i,4:PLOT 85,72*i+64,4 950GCOL 0,3 960 MOVE 72*i,4:DRAW 72*i,x*mpg(i):DRA W 72*i+64,x*mpg(i):DRAW 72*i+64,4 970 VDU5:MOVE -82,12+x*i*10:IF i*10>50 GOTO 980 ELSE PRINT;i*10;SPC(1)INT(28/i ) 980 MOVE 72*i,-36:PRINT;d(i); 990 MOVE 72*i,-72:PRINT;m(i); 1000 MOVE 72*i,-108:PRINT;y(i); 1010VDU4 1020NEXT 1030MOVE 0,600:DRAW 0,0:DRAW 800,0 1040PRINT"Press any key to SAVE or EXIT ." 1050G%=GET 1060REM SAVE mpgs 1070MODE 6 1080PRINT''" SAVE ";C$;" mpg's ? (Y/N)" ; 1090IF INSTR("Yy",GET$) THEN PRINT" Y" ELSE PRINT" N":GOTO 1190 1100file=OPENOUT C$ 1110FOR i=1 TO 10 1120PRINT #file,mpg(i) 1130PRINT #file,d(i) 1140PRINT #file,m(i) 1150PRINT #file,y(i) 1160NEXT 1170PRINT #file,b 1180CLOSE #file 1190PRINT''" To enter another MPG for t his car press R, and to restart program press S. Press any other key to exi t." 1191A$=GET$ 1192IF A$="R" GOTO 270 1193IF A$="S" RUN 1194END 1200DEFPROCINPUT(X) 1210C$="" 1220FOR T=1TOX+1 1230K=GET 1240IFK=127ANDT>1THENT=T-1:VDU127:C$=LE FT$(C$,T-1):GOTO1230 1250IFK=13THENT=X+1:GOTO1300 1260IFK<>13ANDT=X+1THEN1230 1270IFK<32 OR K>126THEN1230 1280C$=C$+CHR$(K) 1290VDUK 1300NEXT:ENDPROC