Google
 

Trailing-Edge - PDP-10 Archives - red405a2 - uetp/lib/mortga.b20
There is 1 other file named mortga.b20 in the archive. Click here to see a list.
00100! NAME--MORTGAGE
00110!
00120! DESCRIPTION--COMPUTES RATE, LIFE, AMOUNT & MONTHLY PAYMENT
00130!
00140! SOURCE--REVISED 9/10/68 BY JIM GUERBER
00150!
00160! THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL
00170! WHICH DOES NOT ASSUME RESPONSIBILITY FOR ITS ACCURACY.
00180!
00190! * * * * * * * * MAIN PROGRAM * * * * * * * * * *
00200!
00210 DIM G$(12),K(70)
00220 DEF FNP(N8,N9)
00230 IF N9<>0 THEN 270
00240 PRINT TAB(N8-3);
00250 PRINT #1, TAB(N8-3);
00260 GOTO 290
00270 PRINT TAB(N8-3-INT(FNS(LOG(ABS(N9))/LOG(10)+.000001)));
00280 PRINT #1, TAB(N8-3-INT(FNS(LOG(ABS(N9))/LOG(10)+.000001)));
00290 IF N9=0 THEN 550
00300 LET P9=0
00310 LET C9=INT(N9*100+.5)
00320 LET F9=INT(C9/100)
00330 LET R9=C9-100*F9
00340 LET T9=INT(F9/10)
00350 LET P9=P9+1
00360 LET T9=INT(F9/10)
00370 LET O(P9)=F9-10*T9+48
00380 LET F9=T9
00390 IF F9>0 THEN 350
00400 LET O(0)=P9+3
00410 LET O(P9+1)=46
00420 LET O(P9+2)=INT(R9/10)
00430 LET O(P9+3)=R9-O(P9+2)*10+48
00440 FOR I9=1 TO P9/2
00450    LET T9=O(I9)
00460    LET O(I9)=O(P9+1-I9)
00470    LET O(P9+1-I9)=T9
00480 NEXT I9
00490 LET O(P9+2)=O(P9+2)+48
00500 CHANGE O TO Q$
00510 PRINT Q$;
00520 PRINT #1, Q$;
00530 LET FNP=C9/100
00540 GO TO 570
00550 PRINT"   0";
00560 PRINT #1,"   0";
00570 FNEND
00580 DEF FNS(N7)=(ABS(N7)+N7)/2
00590 MAT READ G$(12)
00630 OPEN "MORTGA.DAT" FOR OUTPUT AS #1
00640 GOSUB 4070
00650 IF K$<>"RAT" THEN 680
00660 LET Z = 1
00670 GO TO 810
00680 IF K$<>"LIF" THEN 710
00690 LET Z = 2
00700 GOTO 810
00710 IF K$<>"AMO" THEN 740
00720 LET Z = 3
00730 GO TO 810
00740 IF K$<>"MON" THEN 770
00750 LET Z = 4
00760 GOTO 810
00770 PRINT "Your INPUT DATA is spelled incorrectly--Start over."
00780 PRINT
00790 GOSUB 4100
00800 GOTO 650
00810 PRINT
00820 IF Z = 1 THEN 890
00830 PRINT "What is the Annual Interest Rate in PER CENT";
00840 LET R9=R9+1
00850 INPUT R
00860 LET R=R/100
00870 PRINT
00880 IF Z = 2 THEN 930
00890 PRINT "What is the LIFE of the Mortgage: (YEARS, MONTHS)";
00900 INPUT Y, M
00910 PRINT
00920 IF Z = 3 THEN 970
00930 PRINT "What is the amount to be borrowed";
00940 INPUT A
00950 PRINT
00960 IF Z = 4 THEN 1000
00970 PRINT "What is the amount of one monthly payment";
00980 INPUT P
00990 PRINT
01000 GO TO 1560
01010 PRINT"What is the month and year in which the mortgage loan"
01020 PRINT "is to be made (eg. June,1978)";
01030 INPUT Y$, T2
01040 Y$=EDIT$(Y$,32%)
01050 CHANGE Y$ TO K
01060 LET K(0)=3
01070 CHANGE K TO K$
01080 FOR I = 1 TO 12
01090    CHANGE G$(I) TO K
01100    LET K(0)=3
01110    CHANGE K TO G$
01120    IF K$=G$ THEN 1160
01130 NEXT I
01140 PRINT"You have spelled the name of the month incorrectly -- Start over"
01150 GO TO 1010
01160 LET T1 = I
01170 PRINT
01180 PRINT "Enter the beginning and ending calendar years for which You ";
01190 PRINT "want the mortgage table printed out";
01200 MAT INPUT X
01210 IF NUM>2 THEN 1360
01220 IF NUM=0 THEN 1330
01230 IF NUM=1 THEN 1310
01240 IF X(1)<=X(2) THEN 1280
01250 LET T4=X(2)
01260 LET T3=X(1)
01270 GOTO 1380
01280 LET T4=X(1)
01290 LET T3=X(2)
01300 GOTO 1380
01310 LET T4=T3=X(1)
01320 GOTO 1380
01330 LET T4=T2
01340 LET T3=T2+Y+1
01350 GOTO 1380
01360 LET T4=X(1)
01370 LET T3=X(NUM)
01380 PRINT
01390 PRINT "You have a choice of an annual summary of the"
01400 PRINT"mortgage table or a monthly table. Which ( ANN or MON )";
01410 INPUT Y$
01420 Y$=EDIT$(Y$,32%)
01430 CHANGE Y$ TO K
01440 LET K(0)=3
01450 CHANGE K TO K$
01460 IF K$<>"ANN" THEN 1490
01470 LET Z1 = 1
01480 GO TO 1540
01490 IF K$<>"MON" THEN 1520
01500 LET Z1 = 0
01510 GOTO 1540
01520 PRINT"Your spelling is incorrect -- Try again"
01530 GO TO 1360
01540 PRINT
01550 GO TO 2400
01560 PRINT
01570 IF K$="LIF" THEN 1600
01580 LET N = 12*Y+M
01590 IF K$="RAT" THEN 1740
01600 LET R1 = R/12
01610 IF K$="AMO" THEN 1680
01620 IF K$="MON" THEN 1710
01630 LET N = -(LOG(1-(A*R1)/P))/LOG(1+R1)
01640 LET N = INT(N)+1
01650 LET Y = INT(N/12)
01660 LET M = N-12*Y
01670 GO TO 1850
01680 LET A = (P*(1-1/((1+R1)^N)))/R1
01690 LET A=INT(A*100+.5)/100
01700 GO TO 1850
01710 LET P = (A*R1)/(1-1/((1+R1)^N))
01720 LET P=INT(P*100+1)/100
01730 GO TO 1850
01740 LET R1 = 0
01750 FOR O = 1 TO 5
01760    FOR I = 1 TO 10
01770       LET Q = I*(1/(10^O))+R1
01780       LET C = (P*(1-1/((1+Q)^N)))/Q
01790       IF C < A THEN 1810
01800    NEXT I
01810    LET R1 = Q-(1/(10^O))
01820 NEXT O
01830 LET R = R1*12
01840 LET R=INT(R*10000+.5)/10000
01850 PRINT
01860 PRINT #1,
01870 IF 12*P > (R*A+1) THEN 1950
01880 PRINT "Your first Years payments are",12*p
01890 PRINT #1, "Your first year's payments are",12*P
01900 PRINT "The first year's interest is",R*A
01910 PRINT #1, "The first year's interest is",R*A
01920 PRINT "Therefore , the life of the mortgage is undefined"
01930 PRINT #1, "Therefore , the life of the mortgage is undefined"
01940 STOP
01950 PRINT"---------------------------------------------------------------"
01960 PRINT #1,"---------------------------------------------------------------"
01970 PRINT
01980 PRINT #1,
01990 PRINT "    ","*** MORTGAGE TERMS ***"
02000 PRINT #1, "    ","*** MORTGAGE TERMS ***"
02010 PRINT
02020 PRINT #1
02030 PRINT "Annual interest rate ( compounded monthly ) =";R*100;"%"
02040 PRINT #1, "Annual interest rate (compounded monthly) =";R*100;"%"
02050 PRINT "Life of mortgage=";Y,"Years";M,"Months"
02060 PRINT #1, "Life of mortgage=";Y,"Years";M,"Months"
02070 PRINT"Amount borrowed= ";
02080 PRINT #1,"Amount borrowed= ";
02090 LET A=FNP(27,A)
02100 PRINT
02110 PRINT #1,
02120 PRINT"Monthly payment= ";
02130 PRINT #1,"Monthly payment= ";
02140 LET P=FNP(27,P)
02150 PRINT
02160 PRINT #1,
02170 PRINT "Total interest = ";
02180 PRINT #1, "Total interest = ";
02190 LET B7=FNP(27,P*(12*Y+M)-A)
02200 PRINT
02210 PRINT #1,
02220 PRINT
02230 PRINT #1,
02240 PRINT
02250 PRINT #1,
02260 IF Z = 2 THEN 2280
02270 GO TO 2320
02280 PRINT "    ", "NOTE:  The mortgage life has been rounded "
02290 PRINT #1, "    ", "NOTE:  The mortgage life has been rounded "
02300 PRINT "     ", "upward to the nearest month"
02310 PRINT #1, "     ", "upward to the nearest month"
02320 PRINT
02330 PRINT #1,
02340 PRINT"---------------------------------------------------------------"
02350 PRINT #1,"---------------------------------------------------------------"
02360 PRINT
02370 PRINT #1,
02380 GO SUB 3730
02390 GO TO 1570
02400 PRINT "    ","*** MORTGAGE TABLE ***"
02410 PRINT #1, "    ","*** MORTGAGE TABLE ***"
02420 PRINT
02430 PRINT #1,
02440 PRINT
02450 PRINT #1,
02460 LET Z2 = 0
02470 LET S1 = 0
02480 LET S2 = 0
02490 IF T1 = 12 THEN 2520
02500 LET M2 = T1
02510 GO TO 2540
02520 LET T2 = T2+1
02530 LET M2 = 0
02540 LET M3 = M2+1
02550 IF Z1 = 1 THEN 2730
02560 PRINT "   ", "BEGINNING"
02570 PRINT #1, "   ", "BEGINNING"
02580 PRINT "  ", "PRINCIPAL","  ","PRINCIPAL"
02590 PRINT #1, "  ", "PRINCIPAL","  ","PRINCIPAL"
02600 PRINT "MONTH","OUTSTANDING","INTEREST","REPAYMENT"
02610 PRINT #1, "MONTH","OUTSTANDING","INTEREST","REPAYMENT"
02620 PRINT
02630 PRINT #1,
02640 PRINT
02650 PRINT #1,
02660 IF T2<T4 THEN 2680
02670 LET T4=T2
02680 PRINT "  ","For the calendar year",T4
02690 PRINT #1, "  ","For the calendar year",T4
02700 PRINT
02710 PRINT #1,
02720 GO TO 2830
02730 PRINT "   ","   ","   ","ending"
02740 PRINT #1, "   ","   ","   ","ending"
02750 PRINT "   ","   ","PRINCIPAL","PRINCIPAL"
02760 PRINT #1, "   ","   ","PRINCIPAL","PRINCIPAL"
02770 PRINT "YEAR","INTEREST","REPAYMENT","OUTSTANDING"
02780 PRINT #1, "YEAR","INTEREST","REPAYMENT","OUTSTANDING"
02790 PRINT
02800 PRINT #1,
02810 PRINT
02820 PRINT #1,
02830 FOR M1 = M3 TO 12*T3
02840    LET I1 = A*R1
02850    IF P < (A+I1) THEN 2880
02860    LET P1 = A
02870    GO TO 2890
02880    LET P1 = P-I1
02890    LET A1 = A
02900    LET A = A1-P1
02910    LET S1 = S1+I1
02920    LET S2 = S2+P1
02930    LET M2 = M2+1
02940    IF Z1 = 1 THEN 3450
02950    IF T2<T4 THEN 3080
02960    IF T2>T3 THEN 3080
02970    PRINT G$(M2);
02980    PRINT #1, G$(M2);
02990    LET A1=FNP(20,A1)
03000    LET I1=FNP(35,I1)
03010    LET P1=FNP(51,P1)
03060    PRINT
03070    PRINT #1,
03080    IF M2 = 12 THEN 3110
03090    IF A > 0 THEN 3630
03100    LET Z2 = 1 
03110    IF T2<T4 THEN 3300
03120    IF T2>T3 THEN 3300
03130    PRINT
03140    PRINT #1,
03150    PRINT"Interest paid during the year= ";
03160    PRINT #1,"Interest paid during the year= ";
03170    LET S1=FNP(37,S1)
03180    PRINT
03190    PRINT #1,
03200    PRINT"Principal repaid during the year= ";
03210    PRINT #1,"Principal repaid during the year= ";
03220    LET S2=FNP(37,S2)
03230    PRINT
03240    PRINT #1,
03250    PRINT"Principal outstanding at year end= ";
03260    PRINT #1,"Principal outstanding at year end= ";
03270    LET A=FNP(37,A)
03280    PRINT
03290    PRINT #1,
03300    IF Z2 = 1 THEN 3640
03310    LET T2 = T2+1
03320    IF M1= 12* T3 THEN 3640
03330    IF T2<T4 THEN 3600
03340    IF T2>T3 THEN 3600
03350    PRINT
03360    PRINT #1,
03370    PRINT
03380    PRINT #1,
03390    IF M1 = 12*T3 THEN 3640
03400    PRINT "   ", "For the calendar year",T2
03410    PRINT #1, "   ", "For the calendar year",T2
03420    PRINT
03430    PRINT #1,
03440    GO TO 3600
03450    IF M2 = 12 THEN 3480
03460    IF A > 0 THEN 3630
03470    LET Z2 = 1
03480    IF T2<T4 THEN 3570
03490    IF T2>T3 THEN 3570
03500    PRINT T2;
03510    PRINT #1, T2;
03520    LET S1=FNP(20,S1)
03530    LET S2=FNP(37,S2)
03540    LET A=FNP(52,A)
03550    PRINT
03560    PRINT #1,
03570    LET T2 = T2 + 1
03580    IF M1 = 12*T3 THEN 3640
03590    IF Z2 = 1 THEN 3640
03600    LET S1 = 0
03610    LET S2 = 0
03620    LET M2 = 0
03630 NEXT M1
03640 PRINT
03650 PRINT #1,
03660 PRINT
03670 PRINT #1,
03680 PRINT
03690 PRINT #1,
03700 GOTO 4170
03710 DATA JANUARY,FEBRUARY,MARCH,APRIL,MAY,JUNE,JULY
03720 DATA AUGUST,SEPTEMBER,OCTOBER,NOVEMBER,DECEMBER
03730 PRINT
03740 PRINT"Would You like to change something";
03750 INPUT B1$
03760 B1$=EDIT$(B1$,32%)
03770 PRINT
03780 IF B1$ = "NO" THEN 1010
03790 IF B1$ = "N" THEN 1010
03800 PRINT"What would You like to change ( RATe,AMOunt,MONth,LIFe )";
03810 INPUT B$
03820 B$=EDIT$(B$,32%)
03830 CHANGE B$ TO K
03840 LET K(0)=3
03850 CHANGE K TO K$
03860 PRINT
03870 IF K$<>"LIF" THEN 3920
03880 PRINT"What new values do You want: Years , Months";
03890 INPUT Y,M
03900 PRINT
03910 GO TO 4000
03920 PRINT"What value do You want for ";B$;
03930 INPUT B7
03940 PRINT
03950 IF K$<>"RAT" THEN 3980
03960 LET R=B7/100
03970 GO TO 4070
03980 IF K$<>"AMO" THEN 4010
03990 LET A=B7
04000 GO TO 4070
04010 IF K$<>"MON" THEN 4040
04020 LET P=B7
04030 GO TO 4070
04040 PRINT"You input data is spelled incorrectly -- Start over."
04050 PRINT
04060 GO TO 3800
04070 PRINT"This program can compute the RATe , LIFe , AMOunt borrowed"
04080 PRINT"or the MONthly payment."
04090 PRINT"Which do YOU want ( RAT , LIF , AMO , MON )";
04100 INPUT Y$
04110 Y$=EDIT$(Y$,32%)
04120 CHANGE Y$ TO K
04130 LET K(0)=3
04140 CHANGE K TO K$
04150 PRINT
04160 RETURN
04170 END