Trailing-Edge
-
PDP-10 Archives
-
decus_20tap1_198111
-
decus/20-0020/mortga.tuk
There are 2 other files named mortga.tuk in the archive. Click here to see a list.
10' NAME--MORTGAGE
20'
30' DESCRIPTION--COMPUTES RATE, LIFE, AMOUNT & MONTHLY PAYMENT
40'
50' SOURCE--REVISED 9/10/68 BY JIM GUERBER
60'
70' THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL
80' WHICH DOES NOT ASSUME RESPONSIBILITY FOR ITS ACCURACY.
90'
95' * * * * * * * * MAIN PROGRAM * * * * * * * * * *
97'
100 DIM G$(12),K(70)
110 DEF FNP(N8,N9)
111 IF N9<>0 THEN 114
112 PRINT TAB(N8-3);
113 GOTO 120
114 PRINT TAB(N8-3-INT(FNS(LOG(ABS(N9))/LOG(10)+.000001)));
120 IF N9=0 THEN 370
130 LET P9=0
140 LET C9=INT(N9*100+.5)
150 LET F9=INT(C9/100)
160 LET R9=C9-100*F9
170 LET T9=INT(F9/10)
180 LET P9=P9+1
190 LET T9=INT(F9/10)
200 LET O(P9)=F9-10*T9+48
210 LET F9=T9
220 IF F9>0 THEN 180
230 LET O(0)=P9+3
240 LET O(P9+1)=46
250 LET O(P9+2)=INT(R9/10)
260 LET O(P9+3)=R9-O(P9+2)*10+48
270 FOR I9=1 TO P9/2
280 LET T9=O(I9)
290 LET O(I9)=O(P9+1-I9)
300 LET O(P9+1-I9)=T9
310 NEXT I9
320 LET O(P9+2)=O(P9+2)+48
330 CHANGE O TO Q$
340 PRINT Q$;
350 LET FNP=C9/100
360 GO TO 380
370 PRINT" 0";
380 FNEND
385 DEF FNS(N7)=(ABS(N7)+N7)/2
390 MAT READ G$(12)
400 GOSUB3220
410 IF K$<>"RAT" THEN 440
420 LET Z = 1
430 GO TO 570
440 IF K$<>"LIF" THEN 470
450 LET Z = 2
460 GOTO 570
470 IF K$<>"AMO" THEN 500
480 LET Z = 3
490 GO TO 570
500 IF K$<>"MON" THEN 530
510 LET Z = 4
520 GOTO 570
530 PRINT "YOUR INPUT DATA IS SPELLED INCORRECTLY--START OVER."
540 PRINT
550 GOSUB 3240
560 GOTO 410
570 PRINT
580 IF Z = 1 THEN 690
590 PRINT "WHAT IS THE ANNUAL INTEREST RATE IN PER CENT";
600 LET R9=R9+1
610 INPUT R
620 LET R=R/100
670 PRINT
680 IF Z = 2 THEN 730
690 PRINT "WHAT IS THE LIFE OF THE MORTGAGE: YEARS, MONTHS";
700 INPUT Y, M
710 PRINT
720 IF Z = 3 THEN 770
730 PRINT "WHAT IS THE AMOUNT TO BE BORROWED";
740 INPUT A
750 PRINT
760 IF Z = 4 THEN 800
770 PRINT "WHAT IS THE AMOUNT OF ONE MONTHLY PAYMENT";
780 INPUT P
790 PRINT
800 GO TO 1330
810 PRINT"WHAT IS THE MONTH AND YEAR IN WHICH THE MORTGAGE LOAN"
820 PRINT "IS TO BE MADE (EG. JUNE,1969)";
830 INPUT Y$, T2
840 CHANGE Y$ TO K
850 LET K(0)=3
860 CHANGE K TO K$
870 FOR I = 1 TO 12
880 CHANGE G$(I) TO K
890 LET K(0)=3
900 CHANGE K TO G$
910 IF K$=G$ THEN950
920 NEXT I
930 PRINT"YOU HAVE SPELLED THE NAME OF THE MONTH INCORRECTLY -- START OVER"
940 GO TO 810
950 LET T1 = I
960 PRINT
970 PRINT "ENTER THE BEGINNING AND ENDING CALENDAR YEARS FOR WHICH YOU";
980 PRINT "WANT THE MORTGAGE TABLE PRINTED OUT";
990 MAT INPUT X
1000 IF NUM>2 THEN 1150
1010 IF NUM=0 THEN 1120
1020 IF NUM=1 THEN 1100
1030 IF X(1)<=X(2) THEN 1070
1040 LET T4=X(2)
1050 LET T3=X(1)
1060 GOTO 1170
1070 LET T4=X(1)
1080 LET T3=X(2)
1090 GOTO 1170
1100 LET T4=T3=X(1)
1110 GOTO 1170
1120 LET T4=T2
1130 LET T3=T2+Y+1
1140 GOTO 1170
1150 LET T4=X(1)
1160 LET T3=X(NUM)
1170 PRINT
1175 PRINT "YOU HAVE A CHOICE OF AN ANNUAL SUMMARY (ANNUAL) OF THE"
1180 PRINT"MORTGAGE TABLE OR A MONTHLY (MONTHLY) TABLE. WHICH";
1190 INPUT Y$
1200 CHANGE Y$ TO K
1210 LET K(0)=3
1220 CHANGE K TO K$
1230 IF K$<>"ANN" THEN 1260
1240 LET Z1 = 1
1250 GO TO 1310
1260 IF K$<>"MON" THEN 1290
1270 LET Z1 = 0
1280 GOTO 1310
1290 PRINT"YOUR SPELLING IS INCORRECT -- TRY AGAIN"
1300 GO TO 1150
1310 PRINT
1320 GO TO 1940
1330 PRINT
1340 IF K$="LIF" THEN 1370
1350 LET N = 12*Y+M
1360 IF K$="RAT" THEN 1510
1370 LET R1 = R/12
1380 IF K$="AMO" THEN 1450
1390 IF K$="MON" THEN 1480
1400 LET N = -(LOG(1-(A*R1)/P))/LOG(1+R1)
1410 LET N = INT(N)+1
1420 LET Y = INT(N/12)
1430 LET M = N-12*Y
1440 GO TO 1620
1450 LET A = (P*(1-1/((1+R1)^N)))/R1
1460 LET A=INT(A*100+.5)/100
1470 GO TO 1620
1480 LET P = (A*R1)/(1-1/((1+R1)^N))
1490 LET P=INT(P*100+1)/100
1500 GO TO 1620
1510 LET R1 = 0
1520 FOR O = 1 TO 5
1530 FOR I = 1 TO 10
1540 LET Q = I*(1/(10^O))+R1
1550 LET C = (P*(1-1/((1+Q)^N)))/Q
1560 IF C < A THEN 1580
1570 NEXT I
1580 LET R1 = Q-(1/(10^O))
1590 NEXT O
1600 LET R = R1*12
1610 LET R=INT(R*10000+.5)/10000
1620 PRINT
1630 IF 12*P > (R*A+1) THEN 1680
1640 PRINT "YOUR FIRST YEARS'S PAYMENTS ARE"12*P
1650 PRINT "THE FIRST YEARS'S INTEREST IS"R*A
1660 PRINT "THEREFORE, THE LIFE OF THE MORTGAGE IS UNDEFINED"
1670 STOP
1680 PRINT"---------------------------------------------------------------"
1690 PRINT
1700 PRINT " ","*** MORTGAGE TERMS ***"
1705 PRINT
1710 PRINT "ANNUAL INTEREST RATE (COMPOUNDED MONTHLY) =";R*100;"%"
1730 PRINT "LIFE OF MORTGAGE=";Y"YEARS";M"MONTHS"
1740 PRINT"AMOUNT BORROWED= ";
1750 LET A=FNP(27,A)
1760 PRINT
1770 PRINT"MONTHLY PAYMENT= ";
1780 LET P=FNP(27,P)
1790 PRINT
1800 PRINT "TOTAL INTEREST = ";
1810 LET B7=FNP(27,P*(12*Y+M)-A)
1820 PRINT
1830 PRINT
1840 PRINT
1850 IF Z = 2 THEN 1870
1860 GO TO 1890
1870 PRINT " ", "NOTE: THE MORTGAGE LIFE HAS BEEN ROUNDED "
1880 PRINT " ", "UPWARD TO THE NEAREST MONTH"
1890 PRINT
1900 PRINT"---------------------------------------------------------------"
1910 PRINT
1920 GO SUB 2910
1930 GO TO 1340
1940 PRINT " ","*** MORTGAGE TABLE ***"
1950 PRINT
1960 PRINT
1970 LET Z2 = 0
1980 LET S1 = 0
1990 LET S2 = 0
2000 IF T1 = 12 THEN 2030
2010 LET M2 = T1
2020 GO TO 2050
2030 LET T2 = T2+1
2040 LET M2 = 0
2050 LET M3 = M2+1
2060 IF Z1 = 1 THEN 2150
2070 PRINT " ", "BEGINNING"
2080 PRINT " ", "PRINCIPAL"," ","PRINCIPAL"
2090 PRINT "MONTH","OUTSTANDING","INTEREST","REPAYMENT"
2100 PRINT
2109 PRINT
2110 IF T2<T4 THEN 2120
2115 LET T4=T2
2120 PRINT " ","FOR THE CALENDAR YEAR"T4
2130 PRINT
2140 GO TO 2200
2150 PRINT " "," "," ","ENDING"
2160 PRINT " "," ","PRINCIPAL","PRINCIPAL"
2170 PRINT "YEAR","INTEREST","REPAYMENT","OUTSTANDING"
2180 PRINT
2190 PRINT
2200 FOR M1 = M3 TO 12*T3
2210 LET I1 = A*R1
2230 IF P < (A+I1) THEN 2260
2240 LET P1 = A
2250 GO TO 2270
2260 LET P1 = P-I1
2270 LET A1 = A
2280 LET A = A1-P1
2290 LET S1 = S1+I1
2300 LET S2 = S2+P1
2310 LET M2 = M2+1
2320 IF Z1 = 1 THEN 2680
2330 IF T2<T4 THEN 2420
2340 IF T2>T3 THEN 2420
2350 PRINT G$(M2);
2360 LET A1=FNP(20,A1)
2380 LET I1=FNP(35,I1)
2400 LET P1=FNP(51,P1)
2410 PRINT
2420 IF M2 = 12 THEN 2450
2430 IF A > 0 THEN 2860
2440 LET Z2 = 1
2450 IF T2<T4 THEN 2570
2460 IF T2>T3 THEN 2570
2470 PRINT
2480 PRINT"INTEREST PAID DURING THE YEAR= ";
2490 LET S1=FNP(37,S1)
2500 PRINT
2510 PRINT"PRINCIPAL REPAID DURING THE YEAR= ";
2520 LET S2=FNP(37,S2)
2530 PRINT
2540 PRINT"PRINCIPAL OUTSTANDING AT YEAR END= ";
2550 LET A=FNP(37,A)
2560 PRINT
2570 IF Z2 = 1 THEN 2870
2580 LET T2 = T2+1
2590 IF M1= 12* T3 THEN 2870
2600 IF T2<T4 THEN 2830
2610 IF T2>T3 THEN 2830
2620 PRINT
2630 PRINT
2640 IF M1 = 12*T3 THEN 2870
2650 PRINT " ", "FOR THE CALENDAR YEAR"T2
2660 PRINT
2670 GO TO 2830
2680 IF M2 = 12 THEN 2710
2690 IF A > 0 THEN 2860
2700 LET Z2 = 1
2710 IF T2<T4 THEN 2800
2720 IF T2>T3 THEN 2800
2730 PRINT T2;
2740 LET S1=FNP(20,S1)
2760 LET S2=FNP(37,S2)
2780 LET A=FNP(52,A)
2790 PRINT
2800 LET T2 = T2 + 1
2810 IF M1 = 12*T3 THEN 2870
2820 IF Z2 = 1 THEN 2870
2830 LET S1 = 0
2840 LET S2 = 0
2850 LET M2 = 0
2860 NEXT M1
2870 PRINT
2872 PRINT
2874 PRINT
2880 GOTO 3300
2890 DATA JANUARY,FEBRUARY,MARCH,APRIL,MAY,JUNE,JULY
2900 DATA AUGUST,SEPTEMBER,OCTOBER,NOVEMBER,DECEMBER
2910 PRINT
2920 PRINT"WOULD YOU LIKE TO CHANGE SOMETHING";
2930 INPUT B1$
2940 PRINT
2950 IF B1$ = "NO" THEN 810
2960 PRINT"WHAT WOULD YOU LIKE TO CHANGE";
2970 INPUT B$
2980 CHANGE B$ TO K
2990 LET K(0)=3
3000 CHANGE K TO K$
3010 PRINT
3020 IF K$<>"LIF" THEN 3070
3030 PRINT"WHAT NEW VALUES DO YOU WANT: YEARS, MONTHS";
3040 INPUT Y,M
3050 PRINT
3060 GO TO 3150
3070 PRINT"WHAT VALUE DO YOU WANT FOR ";B2$;
3080 INPUT B7
3090 PRINT
3100 IF K$<>"RAT" THEN 3130
3110 LET R=B7/100
3120 GO TO 3220
3130 IF K$<>"AMO" THEN 3160
3140 LET A=B7
3150 GO TO 3220
3160 IF K$<>"MON" THEN 3190
3170 LET P=B7
3180 GO TO 3220
3190 PRINT"YOUR INPUT DATA IS SPELLED INCORRECTLY---START OVER."
3200 PRINT
3210 GO TO 2960
3220 PRINT"THE PROGRAM CAN COMPUTE THE RATE, LIFE, AMOUNT BORROWED"
3230 PRINT"OR THE MONTHLY PAYMENT. WHICH DO YOU WANT";
3240 INPUT Y$
3250 CHANGE Y$ TO K
3260 LET K(0)=3
3270 CHANGE K TO K$
3280 PRINT
3290 RETURN
3300 END