This program is based on one written by Ward Sequin in the March ’85 CATS for the 2068. It had an accuracy problem which I finally blamed on the combination of many iterations in the exponential calculation and the short word length used to store real numbers. This problem was shared in all programs for personal computers that I could check. I found that substitution of a logarithmic series both solved the accuracy problem and speeded the calculation. Increasing the length of the series increases the accuracy. I also revised the program to make annual totals available whatever the loan start month. It is now in QL basic but conversion to any other basic should not be difficult. Enjoy.
100 REMark *** AMORTIZATION ***
110 REMark ** EQUAL PAYMENTS **
120 REMark * by R. W. PARKER**
125 CLS
130 PRINT " AMORTIZATION TABLE"\\
140 PRINT " AMOUNT BORROWED = ";
150 INPUT p
160 PRINT \" NO. OF YEARS TO PAY = ";
170 INPUT y
180 PRINT \" STARTING AT MONTH NO. (1 - 12) "; 190 INPUT st
200 REMark COMPUTE NO. OF MONTHS
210 m=12*y
220 PRINT \" INTEREST / YR (6 1/2% = 6.5%) = ";
230 INPUT i
240 REMark MONTHLY INTEREST
250 r=i/(100*12)
260 REMark EQUAL MONTHLY PAYMENTS
270 REMark m1=(1+r)^m
280le=(1-r/2+r^2/3-r^3/4+r^4/5-r^5/6+r^6/7)*y*i/100
290 REMark e=(p*r*m1)/((1+r)^m-1)
300 m1=EXP (le)
310 e=p*r*m1/(m1-1)
320 e=f(e)
330 e=INT(e+.99)
340 REMark CALCULATE
350 ti=0: tp=0: sp=0
360 yi=0: yp=0: yt=0
370 PRINT \\" MONTHLY PAYMENT = ";e
380 PRINT #0," Hit any key to continue"
390 z$=INKEY$ (-1)
400 CLS
410 PRINT " MO PRINCIPAL INTEREST PRINCIPAL"
420 PRINT " NO OWED PAYMENT PAYMENT"
430 dashes
440 FOR j=1 TO m
450 i1=p*r
460 p1=e-i1
470 IF j=m THEN p1=p+i1
480 PRINT " ";st;" ";f(p);" ";f(i1);" ";f(p1)
490 IF j=m THEN p1=p
500 REMark COMPUTING TOTALS
510 ti=ti+i1
520 yi=yi+i1
530 tp=tp+p1+i1
540 yt=yt+p1+i1
550 sp=sp+p1
560 yp=yp+p1
570 p=p-p1
580 IF st=12 THEN years
590 REMark YEAR TOTALS
600 st=st+1
610 IF st=13 THEN st=1
620 END FOR j
630 IF st<>1 THEN years
640 REMark COMPUTING SUMMARY TOTAL
650 PRINT "TOTAL INTEREST = ";f(ti)
660 PRINT "TOTAL PRINCIPAL = ";f(sp)
670 PRINT "TOTAL PAYMENTS = ";f(tp)
680 STOP
1000 REMark
1010 DEFine FuNction f(x)
1015 LOCal g
1020 g = INT (x*100+.5)/100
1025 RETurn g
1030 END DEFine f
1100 REMark
1110 DEFine PROCedure years
1120 PRINT "YEAR NO. ";INT((j-5)/12)+1;" TOTALS:"
1130 PRINT " TOTAL INTEREST PRINCIPAL"
1140 PRINT " PAID PAYMENT PAYMENT"
1150 PRINT " ";f(yt);" ";f(yi);" ";f(yp)
1160 yi=0: yp=0: yt=0
1170 wait
1180 dashes
1190 PRINT "MO BALANCE INT. PY PRINC."
1200 dashes
1210 END DEFine years
1220 REMark
1230 DEFine PROCedure dashes
1240 FOR k=1 TO 37: PRINT "-";
1250 PRINT
1260 END DEFine dashes
1270 REMark
1280 DEFine PROCedure wait 1290 PRINT #0,"Hit any key to continue"
1300 z$=INKEY$ (-1)
1310 CLS #0
1320 END DEFine wait
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.