Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n7 (Volume 2, Issue 7)
Date: July 1981
Pages: 6-7
This 8K/16K program gives you monthly payments and loan amortization information. To use, type in the program and hit RUN (NL). Answer the prompts, giving your yearly percentage rate as a decimal (thus enter 11% as .11).
The ZX80’s 32-column display width limits the amount of data the schedule tables can hold. At high interest rates (a relative term) the display can’t print the total interest column on 1 line.
Lines 65-75 calculate your monthly payments. The subroutine at 500 is a round off routine. Lines 140-240 provide the table of principal and interest payments:
135 Initialize for amort. sched. 150 Loop for number of payments 155 Compute interest 175 Compute principal 180 Force out last payment 200 Update loan balance 220 Update total interest 225 Allow table to print 1 line at a time. Increase number for slower display, delete line for full screen at once. 230 Print data line 235 Holds display after every 20 data lines until user hits NL, then fills new screen until M data lines (payments). Subroutine at 520 waits for NL to continue.
1 REM "AMORTIZATION"
2 REM BY MEL ROUTT, JUNE 81
3 REM ADAPTED FROM PG 98
4 REM "BASIC PRIMER"
5 REM COPYRIGHT 1978
6 REM BY MITCH WAITE
7 REM AND MICHAEL PARDEE
8 REM HOWARD W SAMS CO INC
9 REM FIRST EDITION
10 CLS
15 PRINT " ENTER:"
20 PRINT "AMOUNT OF LOAN: $";
25 INPUT L
30 PRINT L
35 PRINT "ANNUAL O/O RATE: ";
40 INPUT R
45 PRINT R
50 PRINT "TERM IN YEARS: ";
55 INPUT Y
60 PRINT Y
65 LET I=R/12
70 LET M=Y*12
75 LET A=L*(I*(1+I)**M)/((1+I)**M-1)
80 LET X=A
85 GOSUB 500
90 LET A=X
95 PRINT "MONTHLY PAYMENT= $"; A
100 PRINT
105 PRINT "IF YOU WISH TO VIEW PAYMENT SCHEDULE, TYPE ""YES"". A ""NO"" WILL PERMIT A NEW ENTRY."
110 INPUT A$
115 IF A$="NO" THEN GOTO 125
120 CLS
130 PRINT " SCHEDULE:"
135 GOSUB 510
140 LET B=L
145 LET T=0
150 FOR J=1 TO M
155 LET I1=B*I
160 LET X=I1
165 GOSUB 500
170 LET I1=X
175 LET P=A-I1
180 IF J=M THEN LET P=B
200 LET B=B-P
205 LET X=B
210 GOSUB 500
215 LET B=X
220 LET T=T+I1
225 PAUSE 20
227 POKE 16437,255
230 PRINT J;TAB 3;I1;TAB 10;P;TAB 16;B;TAB 25;T
235 IF J=60 OR J=40 OR J=20 THEN GOSUB 520
240 NEXT J
245 PRINT
250 PRINT "WANT TO PROCESS ANOTHER LOAN? ""YES"" OR ""NO"""
255 INPUT A$
260 IF A$="YES" THEN GOTO 10
270 CLS
275 PRINT
280 PRINT "IT WAS A PLEASURE TO SERVE YOU."
285 STOP
500 LET X=(INT (100*(X+(.005))))/100
505 RETURN
510 PRINT "NO:";TAB 4;"INT:";TAB 10;"PRIN:";TAB 16;"P.BAL:";TAB 25;"T.INT:"
515 RETURN
520 INPUT X$
525 IF X$="" THEN CLS
530 GOSUB 510
535 RETURN
Syntactic Sum: 8420 8K
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.