1 3 PRINT "ANNUIT"
2 5 REM REVISED NOV 07. 1969
3 30 PRINT "WANT INSTRUCTIONS FIRST 1=YES 2=NO";
4 40 INPUT L
5 50 IF L<>1 THEN 70
6 60 GOSUB 600
7 70 LET S=0
8 80 PRINT
9 90 PRINT "WHICH ANNUITY TYPE 1=PAYMENT 2=WITHDRAWAL";
10 100 DEF FNAU=.01*INT100*U+.5
11 110 INPUT A
12 120 GOTO 170
13 130 IF A=1 THEN 160
14 140 LET A=1
15 150 GOTO 170
16 160 LET A=2
17 170 IF A=1 THEN 220
18 180 IF A=2 THEN 1050
19 190 PRINT
20 200 PRINT " ANSWER 1 OR 2 PLEASE."
21 210 GOTO 80
22 220 IF S=1 THEN 260
23 230 PRINT
24 240 PRINT "WHICH VARIABLE IS UNKNOWN 1=N2=A3=I4=R";
25 250 INPUT D
26 260 IF D=1 THEN 330
27 270 IF D=2 THEN 410
28 280 IF D=3 THEN 490
29 290 IF D=4 THEN 520
30 300 PRINT
31 310 PRINT " ANSWER 1,2,3,OR 4 PLEASE."
32 320 GOTO 230
33 330 PRINT
34 340 PRINT "WHAT ARE A$,IPCT,R$";
35 350 INPUT A1,I1,R1
36 360 LET I1=I1/100
37 370 LET N1=LOGA1*I1/R1+1/LOG1+I1
38 380 PRINT
39 390 PRINT "NUMBER OF PERIODS = N =";N1
40 400 GOTO 920
41 410 PRINT
42 420 PRINT "WHAT ARE NINTEGER,IPCT,R$";
43 430 INPUT N1,I1,R1
44 440 LET I1=I1/100
45 450 LET A1=R1*1+I1^N1-1/I1
46 460 PRINT
47 470 PRINT "AMOUNT AT END OF N PERIODS = A =";A1
48 480 GOTO 920
49 490 PRINT
50 500 PRINT "WHAT ARE NINTEGER,A$,R$";
51 510 GOTO 1760
52 520 PRINT
53 530 PRINT "WHAT ARE NINTEGER,A$,IPCT";
54 540 INPUT N1,A1,I1
55 550 LET I1=I1/100
56 560 LET R1=A1*I1/1+I1^N1-1
57 570 PRINT
58 580 PRINT "PAYMENT EACH PERIOD = R =";R1
59 590 GOTO 920
60 600 PRINT
61 610 PRINT "THIS PROGRAM PERFORMS CALCULATIONS FOR"
62 620 PRINT "BOTH PAYMENT AND WITHDRAWAL ANNUITIES."
63 630 PRINT
64 640 PRINT "VARIABLES ARE DENOTED AS FOLLOWS:"
65 650 PRINT
66 660 PRINT " N = NUMBER OF PERIODS"
67 670 PRINT " P = ORIGINAL PRINCIPAL AMOUNT"
68 680 PRINT " A = TOTAL AMOUNT AT END OF N PERIODS"
69 690 PRINT " I = INTEREST RATE PER PERIOD, IN PERCENT"
70 700 PRINT " R = AMOUNT OF PAYMENT/WITHDRAWAL EACH PERIOD"
71 710 PRINT
72 720 PRINT "FOR A PAYMENT ANNUITY, YOU MAY GIVE ANY"
73 730 PRINT " THREE OF N,A,I,R AND FIND THE FOURTH."
74 740 PRINT
75 750 PRINT "FOR A WITHDRAWAL ANNUITY, YOU GIVE ANY"
76 760 PRINT " THREE OF N,P,I,R AND FIND THE FOURTH."
77 770 PRINT
78 780 PRINT "NOTE: FOR LOAN OR MORTGAGE, USE THE"
79 790 PRINT " WITHDRAWAL ANNUITY OPTION."
80 800 PRINT
81 810 PRINT "AFTER EACH CASE, YOU MAY CHOOSE ONE"
82 820 PRINT "OF THE FOLLOWING ALTERNATIVES:"
83 830 PRINT
84 840 PRINT " 1 = ANOTHER CASE, SAME UNKNOWN VARIABLE"
85 850 PRINT " 2 = ANOTHER CASE, DIFFERENT UNKNOWN"
86 860 PRINT " 3 = ANOTHER CASE, OTHER TYPE OF ANNUITY"
87 870 PRINT " 4 = TOTAL INTEREST PAID OVER N PERIODS"
88 880 PRINT " 5 = TABLE OF WITHDRAWALS, PRINCIPAL, AND INTEREST"
89 890 PRINT " 6 = STOP THE PROGRAM"
90 900 PRINT
91 910 RETURN
92 920 PRINT
93 930 PRINT "ANOTHER CASE TYPE CODE NUMBER";
94 940 INPUT S
95 950 IF S=1 THEN 170
96 960 IF S=2 THEN 170
97 970 IF S=6 THEN 9999
98 980 IF S=3 THEN 130
99 990 IF A<>1 THEN 1030
100 1000 PRINT
101 1010 PRINT "ALTERNATIVE NOT APPLICABLE TO PAYMENT ANNUITIES."
102 1020 GOTO 920
103 1030 IF S=4 THEN 1240
104 1040 IF S=5 THEN 1240
105 1050 IF S=1 THEN 1090
106 1060 PRINT
107 1070 PRINT "WHICH VARIABLE IS UNKNOWN 1=N2=P3=I4=R";
108 1080 INPUT A1
109 1090 IF A1=1 THEN 1160
110 1100 IF A1=2 THEN 1660
111 1110 IF A1=3 THEN 1740
112 1120 IF A1=4 THEN 2090
113 1130 PRINT
114 1140 PRINT " ANSWER 1,2,3, OR 4 PLEASE."
115 1150 GOTO 1080
116 1160 PRINT
117 1170 PRINT "WHAT ARE P$,IPCT,R$";
118 1180 INPUT P1,I1,R1
119 1190 LET I1=I1/100
120 1200 LET N1=LOGR1/R1-P1*I1/LOG1+I1
121 1210 PRINT
122 1220 PRINT "NUMBER OF PERIODS = N =";N1
123 1230 GOTO 920
124 1240 LET N1=N1+.00001
125 1250 LET P2=INTN1-N1
126 1260 IF ABSP2>.00001 THEN 1290
127 1270 LET N1=N1-1
128 1280 GOTO 1300
129 1290 LET N1=INTN1
130 1300 LET P2=1
131 1310 IF S=4 THEN 1380
132 1320 IF S=5 THEN 1330
133 1330 LET P2=0
134 1340 PRINT
135 1350 PRINT "PERIOD","PRINCIPAL","INTEREST","PRINC BAL","INT TO DATE"
136 1360 PRINT
137 1370 PRINT " 0"," "," ",P1
138 1380 LET X=0
139 1390 LET X9=P1
140 1400 LET Y=0
141 1410 FOR S=1 TO N1
142 1420 LET A3=R1-P1*I1*1+I1^S-1
143 1430 LET A2=FNAA3
144 1440 LET C=R1-A3
145 1450 LET B=FNAC
146 1460 LET X=X+A3
147 1470 LET X9=X9-A3
148 1480 LET Y=FNAY+C
149 1490 IF P2 <>0 THEN 1510
150 1500 PRINT S,A2,B,X9,Y
151 1510 NEXT S
152 1520 LET S=N1+1
153 1530 LET A3=P1-X
154 1540 LET A2=FNAA3
155 1550 LET B1=I1*A3
156 1560 LET B=FNAB1
157 1570 LET X=X+A3
158 1580 LET X9=0
159 1590 LET Y=Y+B1
160 1600 IF P2=0 THEN 1640
161 1610 PRINT
162 1620 PRINT "TOTAL INTEREST PAID =";Y
163 1630 GOTO 920
164 1640 PRINT S,A2,B,X9,Y
165 1650 GOTO 920
166 1660 PRINT
167 1670 PRINT "WHAT ARE NINTEGER,IPCT,R$";
168 1680 INPUT N1,I1,R1
169 1690 LET I1=I1/100
170 1700 LET P1=R1*1+I1^N1-1/I1*1+I1^N1
171 1710 PRINT
172 1720 PRINT "ORIGINAL PRINCIPAL AMOUNT IS";P1
173 1730 GOTO 920
174 1740 PRINT
175 1750 PRINT "WHAT ARE NINTEGER,P$,R$";
176 1760 INPUT N1,P1,R1
177 1770 PRINT
178 1780 IF N1*R1<=P1 THEN 2170
179 1790 LET I1=.1
180 1800 LET I2=0
181 1810 LET I3=1
182 1820 IF A<>1 THEN 1850
183 1830 LET P3=R1*1+I1^N1-1/I1
184 1840 GOTO 1860
185 1850 LET P3=R1*1+I1^N1-1/I1*1+I1^N1
186 1860 LET P4=ABSP1-P3
187 1870 IF P4>0.001 THEN 1900
188 1880 PRINT "INTEREST PER PERIOD PCT = I =";100*I1
189 1890 GOTO 920
190 1900 IF P4/P1>.3 THEN 2010
191 1910 IF A=1 THEN 1940
192 1920 IF P3<P1 THEN 1980
193 1930 GOTO 1950
194 1940 IF P3>P1 THEN 1980
195 1950 LET I2=I1
196 1960 LET I1=I1+I3/2
197 1970 GOTO 1820
198 1980 LET I3=I1
199 1990 LET I1=I1+I2/2
200 2000 GOTO 1820
201 2010 IF A=1 THEN 2040
202 2020 IF P3<P1 THEN 2060
203 2030 GOTO 1950
204 2040 IF P3>P1 THEN 2060
205 2050 GOTO 1950
206 2060 LET I3=I1
207 2070 LET I1=I1+I2/4
208 2080 GOTO 1820
209 2090 PRINT
210 2100 PRINT "WHAT ARE NINTEGER,P$,IPCT";
211 2110 INPUT N1,P1,I1
212 2120 LET I1=I1/100
213 2130 LET R1=P1*I1*1+I1^N1/1+I1^N1-1
214 2140 PRINT
215 2150 PRINT "WITHDRAWAL EACH PERIOD = R =";R1
216 2160 GOTO 920
217 2170 PRINT"THE PRINCIPAL P IS NOT RECOVERED; I MUST BE POSITIVE."
218 2180 GO TO 1740
219 9999 END