8-Bit Software Online Conversion

Motor Consumption Util - Listing

10im=52768 20*KEY 0 *WIPE Dummy|MY|M*WIPE DATA1| MY|M 30@%=&2020C 40*FX6 50MODE7 60PROCscreen 70PROCmenu 80IFg=6THENMODE7:END 90IFg<>2ANDg<>3THENGOTO70 100IFg=3THENVDU2 110MODE3 120PROCdisplay 130VDU3 140MODE7 150GOTO60 160: 170DEFPROCscreen 180CLS 190PRINTCHR$32+CHR$148+STRING$(37,CHR$ 255) 200FORi=0TO1 210PRINTCHR$141+CHR$148+STRING$(9,CHR$ 255)+CHR$135+"Motoring Expenses"+CHR$148 +STRING$(9,CHR$255) 220NEXT 230PRINTCHR$32+CHR$148+CHR$255+STRING$ (35,CHR$175)+CHR$255 240FORi=1TO18 250PRINTCHR$32+CHR$148+CHR$255+CHR$135 +STRING$(33,CHR$32)+CHR$148+CHR$255 260NEXT 270PRINTCHR$32+CHR$148+CHR$255+STRING$ (35,CHR$252)+CHR$255 280VDU28,4,21,36,4 290PRINTTAB(2,1)"Vehicle :" 300PRINTTAB(2,2)"Registration :" 310VDU28,4,21,36,7 320ENDPROC 330: 340DEFPROCmenu 350CLS 360PRINTTAB(4,2)"1 Add new data" 370PRINTTAB(4,4)"2 View existing data" 380PRINTTAB(4,6)"3 Print existing data " 390PRINTTAB(4,8)"4 Calculate miles per gallon" 400PRINTTAB(4,10)"5 Calculate cost per mile" 410PRINTTAB(4,12)"6 End" 420REPEAT 430g=GET-48 440UNTILg<7ANDg>0 450IFg=1THENPROCadd 460IFg=2ORg=3ORg=6THENENDPROC 470IFg=4THENPROCmpg 480IFg=5THENPROCcpm 490ENDPROC 500: 510DEFPROCdisplay 520PRINT"Motoring Expences by Steve Bo dman for Public Domain May 1991." 530PRINT 540PRINT"Vehicle :" 550PRINT"Registration :" 560tf=0 570tc=0 580PRINT:PRINT 590f=OPENIN"Data2" 600PRINT" Date Fuel Millage Cost" 610REPEAT 620INPUT#f,d$,a,m,c 630PRINTd$,a,m,c 640tf=tf+a 650tc=tc+c 660UNTILEOF#f 670CLOSE#f 680tm=m-im 690tf=tf-a 700PRINT 710PRINT"Total fuel = ";tf" litres" 720PRINT"Total mileage = ";tm;" miles" 730PRINT"Total cost = ";tc;" pounds" 740PRINT:PRINT"Therefore miles per gal lon = ";tm/(tf/4.5);" miles per gallon" 750PRINT:PRINT"Therefore cost per mile = ";tc/tm;" pounds per mile" 760PRINT 770VDU3 780PRINT"Press a key"; 790a=GET 800ENDPROC 810: 820DEFPROCmpg 830tf=0 840CLS 850f=OPENIN"Data2" 860REPEAT 870INPUT#f,d$,a,m,c 880tf=tf+a 890UNTILEOF#f 900CLOSE#f 910tf=tf-a 920tm=m-im 930PRINTTAB(4,5)"Miles per gallon = "; tm/(tf/4.5) 940PRINTTAB(2,11)"Press a key"; 950a=GET 960ENDPROC 970: 980DEFPROCcpm 990CLS 1000tc=0 1010f=OPENIN"Data2" 1020REPEAT 1030INPUT#f,d$,a,m,c 1040tc=tc+c 1050UNTILEOF#f 1060CLOSE#f 1070tm=m-im 1080PRINTTAB(4,5)"Cost per mile = ";tc/ tm 1090PRINTTAB(2,11)"Press a key"; 1100a=GET 1110ENDPROC 1120: 1130DEFPROCadd 1140CLS 1150PRINT 1160PRINT 1170x=OPENOUT"Data1" 1180y=OPENIN"Data2" 1190REPEAT 1200INPUT#y,d$,a,m,c 1210PRINT#x,d$,a,m,c 1220UNTILEOF#y 1230CLOSE#y 1240INPUT" Date ",d$ 1250INPUT" Amount of Litres ",a 1260INPUT" Clock Mileage ",m 1270INPUT" Cost (ie. 12.23) ",c 1280PRINT#x,d$,a,m,c 1290CLOSE#x 1300*RENAME DATA2 DATA3 1310*RENAME DATA1 Data2 1320*RENAME DATA3 Dummy 1330*FX138,0,128 1340ENDPROC