5 CLS  
10 PRINT  "        MORTGAGE AMORTIZATION"  
20 PRINT   
30 PRINT "THIS PROGRAM WILL PRINT A TABLE DESCRIBING MORTGAGE REPAYMENT.  
40 PRINT "INPUT IS THE MORTGAGE PRINCIPAL,MONTHLY PAYMENT,TERM IN YEARS,  
50 PRINT "AND ANNUAL INTEREST RATE.  
60 PRINT "OUTPUT INCLUDES,FOR EACH PAYMENT, AMOUNT AMORTIZED,AMOUNT OF   
70 PRINT "INTEREST, AND BALANCE LEFT ON MORTGAGE.  
90 PRINT   
91 INPUT "IS DELAY AFTER EACH YEAR DESIRED(Y/N)";Z3$  
92 IF  Z3$<>"Y"  AND  Z3$<>"N"  THEN  GOTO  91  
93 INPUT "IS LINE PRINTER OUTPUT DESIRED(Y/N)";Z2$  
94 IF  Z2$<>"Y"  AND  Z2$<>"N"  THEN  GOTO  93  
95 INPUT  "PRESS ENTER TO BEGIN";Z9  
100 CLS  
102 GOTO  110  
104 REM DELETE LINE 102 FOR DOUBLE PRECISION BUT SLOW RESULTS  
105 DEFDBL  A-I,L-X  
110 INPUT  "MORTGAGE PRINCIPAL = ";P  
115 B=P  
120 INPUT  "MONTHLY PAYMENT    = ";M  
130 INPUT  "TERM OF MORTGAGE   = ";Y  
140 INPUT  "ANNUAL INT. RATE(%)= ";I  
150 MI=I/1200 :REM MONTHLY INTEREST RATE  
200 NF = 12*Y  
205 YR=0:ATX=0:IT=0  
210 IF  NF>12 THEN GOTO  300 ' SEE IF MORE THAN 1 YR LEFT  
220 AY=0:IY=0  
230 GOSUB  1000  
235 FOR  K=1  TO  NF-1  
240 GOSUB  1200  
250 NEXT  K  
260 NF=0  
270 GOSUB  1200  
275 F$(1)="FINAL PAYMENT =  $$#####.##"  
280 PRINT USING  F$(1);A+IPX  
285 IF  Z2$="Y"  THEN  LPRINT  USING  F$(1);A+IPX  
295 END  
300 REM FIND RESULTS FOR 1 YEAR  
305 GOSUB  1000  
307 AY=0:IY=0  
310 FOR  K= 1  TO  12  
320 GOSUB  1200  
330 NEXT  K  
340 NF=NF-12  
345 YR=YR+1  
350 GOSUB  1300  
355 IF  Z3$="N"  THEN  GOTO  210  
360 INPUT  "PRESS ENTER FOR ANOTHER YEAR";Z9  
370 GOTO  210  
1000 REM PAGE HEADING SUBROUTINE  
1001 V$="%"  
1005 A1$="PRIN.=$$#####.##  PAYMENT=$$###.##  TERM= ##.## YRS  RATE=##.# !  
1007 A2$=" NO.     INTEREST      AMORTIZED      BALANCE  "  
1010 CLS  
1020 PRINT  USING  A1$;P,M,Y,I,V$;:IF  Z2$="Y"  THEN  LPRINT  USING  A1$;P,M,Y,I,V$  
1030 PRINT  A2$:IF  Z2$="Y"  THEN  LPRINT  A2$:LPRINT  " "  
1050 RETURN   
1100 REM PRINTING SUBROUTINE FOR MONTHLY PAYMENT  
1105 A3$=" ##       ###.##        ####.##      ######.##  
1110 PRINT USING  A3$;NY,IPX,A,B  
1115 IF  Z2$="Y"  THEN  LPRINT  USING  A3$;NY,IPX,A,B  
1120 RETURN   
1200 REM COMPUTATION SUBROUTINE  
1218 NY=K  
1220 IPX=B*MI:A=M-IPX:B=B-A:ATX=ATX+A:IT=IT+IPX:IY=IY+IPX  
1225 AY=AY+A  
1226 IF  NF=0   THEN  A=P-ATX-R  
1227 IF  NF=0   THEN  B=0  
1230 GOSUB  1100  
1240 RETURN   
1300 REM END OF YEAR SUBROUTINE  
1310 A4$="YR.=##    ####.##       ####.##"  
1320 PRINT USING  A4$;YR,IY,AY  
1325 IF  Z2$="Y"  THEN  LPRINT  USING  A4$;YR,IY,AY:LPRINT  " ":LPRINT " "  
1330 RETURN   

