10 REM Program P21 "Travel Costs"
20 CLS
30 LOCATE 11, 8: PRINT "TRAVEL COSTS"
40 FOR i = 1 TO 1000: NEXT i: CLS
50 LOCATE 5, 4: PRINT "This program can be used to calculate the mileage costs between major towns in the U.K. At the moment only 10 towns are in the program, but the program could be expanded to fit your own needs."
60 LOCATE 21, 4: PRINT "PRESS ANY KEY TO CONTINUE"
70 FOR i = 1 TO 1000: NEXT i: CLS
80 DIM c(10, 10): REM array of mileages
90 FOR i = 1 TO 10
100 FOR j = 1 TO i - 1
110 READ c(i, j)
120 LET c(j, i) = c(i, j)
130 NEXT j
140 NEXT i
150 FOR i = 1 TO 10: LET c(i, i) = 0: NEXT i
160 CLS
170 INPUT "Enter mileage rate in "; R
180 PRINT "Mileage rate="; R
190 INPUT "Enter starting town"; t$
200 RESTORE 390
210 LET i = 1
220 READ s$
230 IF s$ <> t$ THEN LET i = i + 1: GOTO 220
240 INPUT "Enter finish town"; u$
250 RESTORE 390
260 LET j = 1
270 READ s$
280 IF s$ <> u$ THEN LET j = j + 1: GOTO 270
290 PRINT ""
300 PRINT "Starting town is "; t$
310 PRINT "Finishing town is "; u$
320 PRINT ""
330 PRINT "Distance = "; c(i, j); " miles"
340 PRINT "Expenses = "; c(i, j) * R
350 INPUT "Another go"; a$
360 IF LEFT$(a$, 1) = "y" THEN GOTO 160
370 STOP
380 DATA 220,135,141,66,278,197,147,170,34,210,131,91,43,196,72,341,150,214,402,221,215,344,109,218,405,225,206,45,54,198,88,117,98,115,289,293,480,236,354,543,362,333,149,127,430
390 DATA "Northampton","Newcastle-on-Tyne","Manchester","London","Liverpool","Leeds","Glasgow","Edinburgh","Birmingham","Aberdeen"