8-Bit Software Online Conversion

Mortgage calculator - Listing

10 REM Calculates the Term and cost o f servicing the mortgage 20 REM Interest is charged on a month ly basis @ 1/12th annual rate 30 REM Also gives mortgagee's accrued income from reinvesting the 40 REM monthly premiums at the same i nterest rate 50 REM Rounding:- >= 0.005 = 0.01 : < 0.005 = 0.00 60 REM (C) DP-J 2Apr91:updated 6Dec91 70 : 80 MODE3 90 PRINTTAB(15,5)"FOR USE OF 8 BIT SO FTWARE USER GROUP MEMBERS ONLY" 100 PRINTTAB(25,7)"Not for PD distribu tion" 110 PRINTTAB(25,12)"-- REPAYMENT MORTG AGES --" 120 @%=&0002020C 130 INPUTTAB(0,15)"Mortgage Principal £ "P 140 INPUT"Annual Interest Rate% "i 150 INPUT"First payment date (dd,mm,y y) "d$,m0,y0 160 INPUT"Desired Mortgage Term (years ) "n%:n%=12*n% 170 PROCpremiums 180 PROCdisplay 190 PRINT'TAB(20)"OK, FINISHED"' 200 END 210 : 220 DEF PROCpremiums 230 M=P*((i/1200)*(1+i/1200)^n%)/((1+i /1200)^n%-1) 240 PRINT'"Monthly premiums are £ ";M 250 PROCnewpremium 260 ENDPROC 270 : 280 DEF PROCnewpremium 290 PRINT'"Do you wish to pay a differ ent premium (Yy/Nn) ?":REPEAT:g$=CHR$(G ET AND 95):UNTIL INSTR("YN",g$)<>0 300 IFg$="Y" INPUT"How much ?"M 310 ENDPROC 320 : 330 DEF PROCdisplay 340 RESTORE:FORj=1TOm0:READm0$:NEXT:RE M store start month string 350 m=m0-1:IFm<1 m=12:y=y0-1 ELSE y=y0 360 RESTORE:FORj=1TOm:READm$:NEXT:REM initialise DATA pointer to m 370 Pbal=P:Mar=0:REM Pbal is the Princ ipal balance at end of month 380 REM Mar is Mortgagee' s Accrued Return at end of month 390 mth%=0:Itodate=0:REM mth% is month counter 400 flag%=0 410 PRINT'"Detailed Listing (L) or Sum mary only (S) ?" 420 VDU14:VDU26 430 REPEAT:g$=CHR$(GET AND 95):UNTIL I NSTR("LS",g$)<>0:CLS 440 IFg$="L" PROClist ELSE PRINTTAB(18 ,12)"JUST HAVING A BYTE .....BACK SOON": PROCsummary 450 PRINT'"Loan Principal "P 460 PRINT"Annual Interest Rate%"i 470 PRINT"Monthly Repayment "M 480 PRINT'"First payment date ";d$" " ;m0$" ";:IFy0<10 PRINT"0";STR$(y0) ELSE PRINTSTR$(y0) 490 PRINT" Mortgage Term : months "STR$(mth%) 500 PRINT" Final " STR$(mth%)"";:PROC th:PRINT" month payment"SPC(3-LENSTR$(mt h%))Mfinal 510 PRINT'"Completion Date "d$" "; m$" ";:IFy<10 PRINT"0";STR$(y) ELSE PRIN TSTR$(y) 520 PRINT" Total Interest charges " Itodate 530 Tcost=(mth%-1)*M+(M+Pbal):PRINT" Total Cost "Tcost 540 @%=&0002030C:PRINT" Cost Factor "Tcost/P 550 @%=&0002020C:PRINT'"Mortgagee's ac crued returns"Mar 560 @%=&0002030C:PRINT" Return Factor "Mar/P 570 @%=&0002020C:m=m0:y=y0 580 VDU15 590 PRINT'"Do you want to see an earli er Closing Balance (Yy/Nn) ?" 600 REPEAT:g$=CHR$(GET AND 95):UNTIL I NSTR("YyNn",g$)<>0 610 IFg$="Y" PROCclosing:PRINT'"Anothe r date (YyNn) ?":GOTO600 620 PRINT'"REPEAT ? (Rr) or NEW MORTGA GE ? (Mm) or QUIT ? (Qq) ":REPEAT:g$=CH R$(GET AND 95):UNTIL INSTR("RrMmQq",g$)< >0 630 IFg$="R" PROCnewpremium:PROCdispla y 640 IFg$="M" RUN 650 ENDPROC 660 : 670 DEF PROCclosing 680 INPUT"What date ? mm,yy "mm,yy; 690 IFyy<10 yy$="0"+STR$(yy) ELSE yy$= STR$(yy):REM Convert 00-09 decimal to 00 -09 string for year 2000-2009 700 IFyy<y0 yy=yy+100 710 flag%=1+mm-m0+12*(yy-y0) 720 IF flag%<=0 OR flag%>mth% OR mm>12 PRINT"INVALID DATE ":GOTO680 730 Pbal=P:Mar=0:mth%=0:PROCsummary:PR INT'"Closing balance at "d$;"/"STR$(mm) ;"/"yy$" is £ "X;" plus early closur e penalty, if any." 740 ENDPROC 750 : 760 DEF PROClist 770 PRINTTAB(2)"Due";TAB(12)"Month";TA B(21)"Interest";TAB(33)"Monthly";TAB(45) "Total";TAB(56)"Balance";TAB(70)"Mar" 780 PRINTTAB(2)"date";TAB(12)"ref no"; TAB(23)"due";TAB(33)"payment";TAB(44)"In t paid";TAB(57)"Owing" 790 VDU28,0,24,79,3 800 PRINT'TAB(42)"(Mortgage =";TAB(60- LEN(STR$(INT(P))));P")" 810 REPEAT 820 m=m+1:IFm MOD12=1 RESTORE:READm$:y =y+1:y=y MOD100 ELSE READm$ 830 PRINTd$" ";m$" ";:IFy<10 PRINT"0"; STR$(y);ELSE PRINTSTR$(y); 840 mth%=mth%+1 :PRINTTAB(15-LENSTR$(m th%))STR$(mth%); 850 Idue=Pbal*i/1200:Itodate=Itodate+I due:PRINTIdue; 860 IF M<=Pbal PRINTM; ELSE Mfinal=Pba l+Idue:PRINTMfinal; 870 PRINTItodate; 880 Pbal=Pbal+Idue-M:IF Pbal<0 PRINT0; :Mar=Mar+Mar*i/1200+Pbal+M:PRINTMar ELSE PRINTPbal;:IFmth%=1 Mar=M:PRINTMar ELSE Mar=Mar+Mar*i/1200+M:PRINTMar 890 UNTIL Pbal<.01 900 ENDPROC 910 : 920 DEF PROCsummary 930 REPEAT 940 mth%=mth%+1 950 Idue=Pbal*i/1200 :Itodate=Itodate+ Idue:Pbal=Pbal+Idue-M 960 IFmth%=flag% X=Pbal+M:REM X is clo sing balance 970 IF Pbal<.01 Mfinal=Pbal+M:Mar=Mar +Mar*i/1200+Pbal+M ELSE Mar=Mar+Mar*i/12 00+M 980 UNTIL Pbal<.01 990 y=(y0+(m0+mth%-1) DIV12) MOD100 :R EM Calc. final year. MOD100 for y>2000 1000 m=(m0+mth%-1) MOD12:IFm=0 m=12:y=y -1:REM Calc. final month 1010 RESTORE:FORj=1TOm:READm$:NEXT 1020 IF flag%=0 CLS 1030 ENDPROC 1040 : 1050 DEF PROCth 1060 Z%=mth% MOD100 1070 IF Z%>10 AND Z%<14 Z%=0 1080 Z%=Z% MOD10 1090 IF Z%=1 PRINT"st";:ENDPROC 1100 IF Z%=2 PRINT"nd";:ENDPROC 1110 IF Z%=3 PRINT"rd";:ENDPROC 1120 PRINT"th";:ENDPROC 1130 : 1140 DATA Jan,Feb,Mar,Apr,May,Jun,Jul,A ug,Sep,Oct,Nov,Dec