Reference Dl
BASIC Programs
This reference provides some
simple BASIC programs you
might want to enter and save.
When entering a BASIC pro-
gram, you must type it exactly as
shown. A misspelled word or
misplaced parenthesis could cause
the program not to run.
LOAN.BA
This program computes a full
amortization table of a loan.
You input: (1) the full amount of
the loan (do not type a comma
or a dollar sign), (2) the interest
you pay, and (3) the total
number of months to pay off the
loan (for example, 20 years X 12
= 240 months).
10
CLS.-INPUT "TYPE
LOAN AMOUNT";L
20
INPUT "ANNUAL IN-
EREST RATE IN PER-
CENTER
30
INPUT "NUMBER OF
MONTHS TO PAY OFF
LOAN";M
40
R = R * .01/12
50
P =.R * L/(1-(1+R)
A
(-
M))
60
I°/o=l:OA = L:CLS
70
PRINT "NUMBER IN-
TEREST PRINCIPAL NEW
D A T "
8OF1$ = "#####,###.#####,
90
F2$ = "MONTHLY
PAYMENT =$##,###.##"
100 F3$ = "TOTAL IN-
TEREST PAID = $##,###.##"
110 X = X + 1
120 MC = R * L
130 PP = P—MC
140 NB = L—PP
150 TI = TI + MC
160 PRINT USING
F1$;I%,MC,PP,NB
170 IF X = 14 THEN
GOSUB 240
180 IF 1% <> M THEN 1%
= 1% + 1: L = NB: GOTO
110
190 GOSUB 240
200 PRINT "ON $ " OA
"LOAN AT " R*1200 "% IN-
TEREST RATE FOR " 1%
"MONTHS"
210 PRINT:PRINT USING
F2$;P
220 PRINT USING F3$;TI
230 END
240 INPUT "PRESS (ENTER)
TO CONTINUE";R$: X= 0:
CLS
250 RETURN
SORT.BA
This program sorts all the
records in ADRS.DO; then stores
the sorted list in SORT.DO.
Warning: If you already have a
file named SORT.DO, running
this program will delete all infor-
mation in the file.
: i
56 / References