home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1989 July / 1989-07.d64 / planner (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1989-01-01  |  21.0 KB  |  644 lines

  1. 10 rem copyright 1989 compute! publications, inc. - all rights reserved
  2. 20 printchr$(147);chr$(14);chr$(8):poke53281,0:poke53280,11:poke646,13
  3. 30 printspc(12)"[195]opyright 1989":print spc(6)"[195][207][205][208][213][212][197]! [208]ublications, [201]nc."
  4. 40 print spc(10)"[193]ll rights reserved."
  5. 50 sa=52224:if peek(sa)=169 and peek(sa+206)=96 then clr:goto250
  6. 60 h1=int((sa+13)/256):l1=(sa+13)-h1*256
  7. 70 h2=int((sa+150)/256):l2=(sa+150)-h2*256:cs=0
  8. 80 for ad=satosa+206:readml:cs=cs+ml:pokead,ml:next
  9. 90 if cs<>23175 then print chr$(147)"error in ml data":end
  10. 100 poke sa+5,l1:poke sa+9,h1:poke sa+133,l2:poke sa+138,h2
  11. 110 sys sa:clr
  12. 120 data 169,76,133,124,169,13,133,125,169,192,133,126,96,141,255,3
  13. 130 data 104,141,252,3,104,141,253,3,72,173,252,3,72,201,217,208
  14. 140 data 7,173,253,3,201,183,240,11,173,255,3,201,58,176,3,76
  15. 150 data 128,0,96,104,169,220,72,186,142,254,3,165,113,141,248,3
  16. 160 data 165,114,141,249,3,162,79,189,0,2,157,167,3,202,16,247
  17. 170 data 56,165,36,229,122,168,162,23,201,81,176,73,169,0,141,13
  18. 180 data 3,153,0,2,136,177,122,153,0,2,136,16,248,169,0,133
  19. 190 data 122,169,2,133,123,32,121,165,173,0,3,141,250,3,173,1
  20. 200 data 3,141,251,3,169,150,141,0,3,169,192,141,1,3,32,115
  21. 210 data 0,32,138,173,162,0,173,250,3,141,0,3,173,251,3,141
  22. 220 data 1,3,173,13,3,138,141,13,3,240,6,169,0,133,97,133
  23. 230 data 102,173,248,3,133,113,173,249,3,133,114,162,79,189,167,3
  24. 240 data 157,0,2,202,16,247,169,0,133,13,174,254,3,154,96,0
  25. 250 dn$="":lt$="":sp$=" ":dc$=dn$:hd$="":hr$=hd$+"":h$="":r$=""
  26. 260 cd$="[147]":c2$=cd$+dc$:u$="[145]":u3$=u$+u$+u$:er$=" "+r$+"error"
  27. 270 for i=1 to 6:dn$=dn$+dn$:lt$=lt$+lt$:sp$=sp$+sp$:next
  28. 280 dn$=left$(dn$,24):lt$=left$(lt$,40):sp$=left$(sp$,39)
  29. 290 dim c%(255),fc$(22),fc%(22),fv(22),v2(22),zf(22):printchr$(14)
  30. 300 dim cf(50),cp(50),cw(50),a(50),w(50),p(50),q(50),i2(50),w2(50),tp(39)
  31. 310 poke 784,108:poke785,122:poke786,0
  32. 320 def fn rs(ln)=usr(ln)+pos(" [184] [163][168][168][198]_[165]_l'[168]")
  33. 330 t=fn rs(360)
  34. 340 for k=1 to 12:read a:c%(a)=k:next
  35. 350 for k=49 to 58:c%(k)=10:next:c%(17)=5:c%(32)=7
  36. 360 data 67,95,133,134,13,145,147,20,46,48,89,78
  37. 370 poke 784,108:poke785,122:poke786,0
  38. 380 def fn r2(rr)=int(an/rr+.5)*rr
  39. 390 def fn rd(rr)=int(rr*100+.5)/100
  40. 400 printcd$
  41. 410 printhd$;dc$"[198]inancial [208]lanner";dc$:print"[208]ress # of option";dc$
  42. 420 print"1. [195]ollege planning"
  43. 430 print"2. [195]ar buy/lease"
  44. 440 print"3. [195]ompound interest/savings"
  45. 450 print"4. [204]oan payments"
  46. 460 print"5. [198]ixed/adjustable rate mortgage"
  47. 470 print"6. [200]ow much life insurance do you need?"
  48. 480 print"7. [211]hould you refinance your mortgage?"
  49. 490 print"8. [201][210][193][160]planning":af=0
  50. 500 geta$:if a$="" then500
  51. 510 c=c%(asc(a$)):if c=1 then gosub930:goto410
  52. 520 if c=2 then printchr$(147):end
  53. 530 if c<>10 then400
  54. 540 printdc$;r$"[210]eading data statements ..."
  55. 550 on val(a$) goto2000,3000,4000,5000,6000,7000,8000,9000
  56. 560 goto400
  57. 570 rem--
  58. 580 for i=0 to nr:printfc$(i);:gosub820:next:return
  59. 590 rem print screen subroutine
  60. 600 rr=1104:px=0:py=0:my=22:for ty=22 to 10 step-1
  61. 610 if peek(rr+ty*40)<>32 or peek(rr+ty*40+1)<>32 then my=ty:ty=10
  62. 620 next:gosub1940:gosub720:if t<0 then710
  63. 630 printhr$"[208][210][201][206][212][201][206][199] ...":open7,4,7
  64. 640 for i=0 to my:t$=dc$:h=-2
  65. 650 for j=0 to 39:a=peek(rr+i*40+j) and 127:if a=96 then a=32:goto690
  66. 660 if a>0 and a<27 then a=a+64:goto680
  67. 670 if a>64 and a<91 then a=a+128
  68. 680 if a<>32 then h=j
  69. 690 t$=t$+chr$(a):next
  70. 700 t$=left$(t$,h+2):print#7,t$:next:close7
  71. 710 gosub1950:return
  72. 720 open7,4,7:close7:t=st
  73. 730 open7,4:if st=t then close7:return
  74. 740 printhd$sp$:printu$"[208]rinter not ready, press _ to cancel"
  75. 750 geta$:if a$="_" then t=-1:close7:return
  76. 760 if a$="" then t=t+1:if t<9 then750
  77. 770 t=0:printhd$;sp$:close7:goto720
  78. 780 gosub1070:if qa=2 then return
  79. 790 t$=t2$
  80. 800 printh$;left$(dn$,cy+2);fc$(cy);tab(lc-9);left$(sp$,9)
  81. 810 printh$;left$(dn$,cy+2);fc$(cy);:i=cy
  82. 820 if fc%(i)=0 then print:return
  83. 830 on fc%(i) gosub850,880,890,910
  84. 840 print tab(lc-len(t$)-(1=fc%(i)));t$:return
  85. 850 if sf=0 then t$=mid$(str$(fv(i)),2,6)+"%":return
  86. 860 t$=t2$+"%":if t2$="" then t$="0%"
  87. 870 return
  88. 880 t$="$"+mid$(str$(int(fv(i)+.5)),2):return
  89. 890 t$="no":if fv(i) then t$="yes"
  90. 900 return
  91. 910 t$=mid$(str$(int(fv(i))),2):return
  92. 920 rem calculator subroutine
  93. 930 printh$;sp$
  94. 940 t=0:a2$="":t$=hd$+sp$+"[145]":printt$:if cc$<>"" then a2$=str$(val(cc$))
  95. 950 printt$:for t2=0 to t:next:print"?"a2$
  96. 960 geta$:if a$<>"" then990
  97. 970 t=t+1:if t>199 then t=0:goto950
  98. 980 goto960
  99. 990 t=0:a=asc(a$):if a=13 then cc$=a2$:goto930
  100. 1000 if(a>38 and a<58 and a<>44) or a=94 then a2$=left$(a2$+a$,38):goto950
  101. 1010 if a=95 or a=67 then printh$;sp$:printsp$:return
  102. 1020 if a=20 then if len(a2$) then a2$=left$(a2$,len(a2$)-1):goto950
  103. 1030 if a=147 or a=19 then a2$="":goto950
  104. 1040 if a<>81 and a<>69 and a<>61 then960
  105. 1050 print t$;h$;sp$:if len(cc$)<21 then printh$;cc$" =";
  106. 1060 printval(cc$):return
  107. 1070 if fc%(cy)<>0 then1100
  108. 1080 sf=0:gf=0:gosub1420:cy=cy+1:if cy>nr then cy=0
  109. 1090 goto1070
  110. 1100 if sf=0 then t2$=mid$(str$(fv(cy)),2):sf=1
  111. 1110 printh$;left$(dn$,cy+2);r$;:i=cy:gosub820:qa=3
  112. 1120 geta$:if a$="" then1120
  113. 1130 a=asc(a$)
  114. 1140 on c%(a) goto1160,1170,1180,1120,1190,1230,1270,1290,1370,1400,1330,1350
  115. 1150 goto1120
  116. 1160 gosub930:goto1120
  117. 1170 qa=1:return
  118. 1180 qa=2:gosub1770:return
  119. 1190 if a<>17 and a<>13 then1230
  120. 1200 gosub800:gf=0:gosub1420:cy=cy+1:sf=0:if cy>nr then cy=0
  121. 1210 if fc%(cy)=0 then1200
  122. 1220 return
  123. 1230 gosub800
  124. 1240 gf=0:gosub1420:cy=cy-1:sf=0:if cy<0 then cy=nr
  125. 1250 if fc%(cy)=0 then1240
  126. 1260 return
  127. 1270 if a=147 or (a=32 and fc%(cy)<>3) then t2$="":fv(cy)=0:return
  128. 1280 goto1320
  129. 1290 if len(t2$)<2 then t2$="":fv(cy)=0:return
  130. 1300 t2$=left$(t2$,len(t2$)-1):fv(cy)=val(t2$):return
  131. 1310 rem
  132. 1320 fv(cy)=1-fv(cy):return
  133. 1330 if fc%(cy)=3 then fv(cy)=1
  134. 1340 return
  135. 1350 if fc%(cy)=3 then fv(cy)=0
  136. 1360 return
  137. 1370 if fc%(cy)<>1 then return
  138. 1380 for j=1 to len(t2$):if mid$(t2$,j,1)=chr$(46) then j=7:next:return
  139. 1390 next j
  140. 1400 if gf=0 then gf=1:t2$=a$:fv(cy)=val(t2$):return
  141. 1410 t2$=left$(t2$+a$,7):fv(cy)=val(t2$):return
  142. 1420 if fc%(cy)=0 then return
  143. 1430 if fc%(cy)<>1 then1500
  144. 1440 t$=hd$+sp$+hd$+"[215][193][210][206][201][206][199] - % rate "
  145. 1450 if fv(cy)>100 then printt$;"greater than 100":return
  146. 1460 if fv(cy)=0 then printt$;"is zero":return
  147. 1470 if v2(cy)>0 and fv(cy)>v2(cy)*2+4 then printt$;"very high":return
  148. 1480 if v2(cy)>0 and fv(cy)<.1 then printt$"very low":return
  149. 1490 goto1540
  150. 1500 if fc%(cy)<>4 then1540
  151. 1510 t$=hd$+sp$+hd$+"[215][193][210][206][201][206][199] - # is[160]"
  152. 1520 if fv(cy)=0 thenprintt$;"zero":return
  153. 1530 if v2(cy)>0 and fv(cy)>v2(cy) thenprintt$;"extremely large":return
  154. 1540 printhd$;sp$:return
  155. 1550 if qt=zt then return
  156. 1560 qt=zt:t=fn rs(zt):i=0
  157. 1570 zf(i)=0:read fc$(i):if fc$(i)="e" then nr=i-1:return
  158. 1580 if fc$(i)<>"ir" then1600
  159. 1590 fc$(i)="[201]nflation rate":fc%(i)=1:fv(i)=4.4:v2(i)=5:goto1630
  160. 1600 v2(i)=-1:read fc%(i):if fc%(i) then read fv(i):v2(i)=fv(i)
  161. 1610 if fc%(i)=4 or fc%(i)=1 then read zf(i)
  162. 1620 if fc%(i)=4 then read v2(i)
  163. 1630 i=i+1:goto1570
  164. 1640 r4=12:goto1660
  165. 1650 r4=7
  166. 1660 t$="$"+mid$(str$(int(rr+.5)),2):printleft$(sp$,r4-len(t$));t$;:return
  167. 1670 print"$"mid$(str$(int(rr+.5)),2);:return
  168. 1680 an$="$"+mid$(str$(an),2)
  169. 1690 if an=int(an) then an$=an$+".00":return
  170. 1700 if abs(an*10-int(an*10+.5))<.001 then an$=an$+"0"
  171. 1710 return
  172. 1720 print:print"[195]hange any or all values, then move"
  173. 1730 print"cursor to the number you want"
  174. 1740 print"calculated and press f1."
  175. 1750 cy=2:sf=0:return
  176. 1760 an=fn rd(an):gosub1680:printleft$(sp$,11-len(an$));an$;:return
  177. 1770 printh$;left$(dn$,nr+4);:for rr=nr+4 to 23:printsp$:next
  178. 1780 print h$;left$(dn$,nr+4):if af=1 then fv(cy)=.01
  179. 1790 for k=2 to nr:if zf(k)=0 or fv(k)>00 then1820
  180. 1800 printfc$(k)" = 0";er$:k=nr:qa=3
  181. 1810 print" [195]hange value then f1 calc, _ menu"
  182. 1820 next:if qa=3 then return
  183. 1830 print h$;left$(dn$,nr+4);r$"calculating..."u$:sf=0:return
  184. 1840 print:print"[197]nter all values then press f1 to calc":cy=2:sf=0:return
  185. 1850 printhr$u$"[208]ress f5 ";t$:pf=-1
  186. 1860 printhr$"[208]ress f1 another, f3 print, _ menu":gf=0
  187. 1870 geta$:if a$="" then1870
  188. 1880 a=asc(a$):if a=67 then gosub1940:gosub930:gosub1950:goto1870
  189. 1890 if pf<0 and a=135 then ra=4:goto1920
  190. 1900 if c%(a)>4 then1870
  191. 1910 ra=c%(a)-1:if ra<1 or ra>3 then1870
  192. 1920 if pf<0 then printh$;sp$:pf=0
  193. 1930 printhd$;sp$:return
  194. 1940 for k=0 to 39:tp(k)=peek(1064+k):next:return
  195. 1950 for k=0 to 39:poke 1064+k,tp(k):next:return
  196. 2000 rem--
  197. 2010 data "[195]ollege planning",0," ",0
  198. 2020 data "[212]oday's annual cost",2,11500
  199. 2030 data ir
  200. 2040 data "[217]ears until college",4,12,1,18
  201. 2050 data "# years in college",4,4,1,8," ",0
  202. 2060 data "[208]resent savings",2,8500
  203. 2070 data "[193]fter tax yield ",1,7.35,1
  204. 2080 data e
  205. 2090 zt=2000:lc=28:gosub1550
  206. 2100 printcd$:sf=0
  207. 2110 gosub580
  208. 2120 gosub1840
  209. 2130 gosub780
  210. 2140 on qa goto400,2150,2130
  211. 2150 if fv(4)=0 or fv(5)=0 then an=fv(cy):print"# years 0"+er$:goto2330
  212. 2160 t2=0:t3=0:t4=0:ri=1+(fv(8)-fv(3))/100:r3=1+fv(3)/100:r8=1+fv(8)/100
  213. 2170 for i=fv(4) to fv(4)+fv(5)-1
  214. 2180 t2=t2+fv(2)/ri^i
  215. 2190 t3=t3+r3^fv(4)/(ri^(i-fv(4)))
  216. 2200 t4=t4+r3^i*fv(2)
  217. 2210 next i:t3=t3*fv(2)-fv(7)*r8^fv(4)
  218. 2220 print"[212]otal college costs will be $";int(t4+.5):print
  219. 2230 if fv(8)=0 then an=t3/fv(4):goto2250
  220. 2240 an=t3*fv(8)/100/(r8^fv(4)-1)
  221. 2250 if an>0 then2280
  222. 2260 rr=fv(7)-t2:print"[211]avings exceed needs by ";:gosub1670
  223. 2270 print".":q2=0:goto2330
  224. 2280 print"[217]ou need to save $"fn r2(25)"every year"
  225. 2290 print"for the next";fv(4)"years":an=t2-fv(7)
  226. 2300 print"[207][210] set aside an additional $";fn r2(500)
  227. 2310 print"today to pay for college."
  228. 2320 an=an+fv(7):q2=fn r2(500)
  229. 2330 gosub1860:on ra goto400,2100
  230. 2340 gosub600:goto2330
  231. 3000 rem--
  232. 3010 data "[195]ar buy/lease",0
  233. 3020 data " ",0
  234. 3030 data ir," ",0
  235. 3040 data "--[194][213][217]--",0
  236. 3050 data "[208]rice of [195]ar",2,12500
  237. 3060 data " [198]inancing",3,1
  238. 3070 data "  [212]rade in/down payment",2,2000
  239. 3080 data "  [193]nnual % rate",1,12,1
  240. 3090 data "  # of monthly payments",4,60,1,84,"--[204][197][193][211][197]--",0
  241. 3100 data " [210]efundable security dep",2,250
  242. 3110 data " [201]nitial payment",2,378
  243. 3120 data " [205]onthly payment",2,189
  244. 3130 data " # of payments",4,60,0,84
  245. 3140 data " [194]uy out price",2,6200
  246. 3150 data e
  247. 3160 zt=3000:lc=31:gosub1550
  248. 3170 printcd$:sf=0
  249. 3180 gosub580
  250. 3190 gosub1840
  251. 3200 print:print"[217]ears to months: 3/36, 4/48, 5/60"
  252. 3210 gosub780
  253. 3220 on qa goto400,3230,3210
  254. 3230 if fv(6)=0 then tc=fv(5):goto3280
  255. 3240 tc=fv(7):i=fv(8)/100:r2=(1+fv(2)/100)^(1/12):p=fv(5)-fv(7)
  256. 3250 ep=(i*p/12)/(1-1/(i/12+1)^(12*fv(9)/12))
  257. 3260 for j=1 to fv(9)
  258. 3270 tc=tc+ep/(r2^j):next
  259. 3280 t2=fv(12):ri=(1+fv(2)/100)^(1/12):t2=t2+fv(11)-fv(11)/ri^fv(14)
  260. 3290 for j=1 to fv(14)
  261. 3300 t2=t2+fv(13)/ri^j:next:t2=t2+fv(15)/ri^fv(14)
  262. 3310 print"[212]otal costs for buying: $";:if fv(6)=0 then printfv(5):goto3330
  263. 3320 print int(ep*fv(9)+fv(7)+.5)
  264. 3330 print spc(15)"leasing: $";int(fv(13)*fv(14)+fv(12)+fv(15)+.5)
  265. 3340 print"[210]eal costs, after inflation adjustment"
  266. 3350 print spc(16)"buying: $";int(tc+.5)
  267. 3360 print spc(15)"leasing: $";int(t2+.5)
  268. 3370 if fv(6)=0 then3390
  269. 3380 print" [205]onthly payments if financed: $";int(ep+.5);h$
  270. 3390 gosub1860:on ra goto400,3170
  271. 3400 gosub600:goto3390
  272. 4000 rem--
  273. 4010 data "[195]ompound interest/savings",0," ",0
  274. 4020 data "[208]resent value",2,2915
  275. 4030 data "[205]onthly addition",2,35
  276. 4040 data "[193]nnual yield",1,6.29,0
  277. 4050 data "# of years",4,9,0,49
  278. 4060 data "[198]uture value",2,10000
  279. 4070 data e
  280. 4080 zt=4000:lc=25:gosub1550
  281. 4090 printcd$:sf=0:af=1
  282. 4100 gosub580
  283. 4110 gosub1720
  284. 4120 gosub780
  285. 4130 on qa goto400,4140,4120
  286. 4140 pv=fv(2):r=fv(3):n=12:ri=(1+fv(4)/100)^(1/12):i=1-ri:y=fv(5):t=fv(6)
  287. 4150 ny=y*12:t2=pv*ri^ny:t=t-t2:rn=ri^ny:in=fv(4)/1200
  288. 4160 on cy-1 goto4170,4190,4250,4360,4420
  289. 4170 t4=0:for k=0 to y*12-1:t4=t4+r*ri^k:next
  290. 4180 an=(fv(6)-t4)/rn:an=int(an+.5):goto4440
  291. 4190 if ri=1 then an=(fv(6)-pv)/ny:goto4210
  292. 4200 t5=(fv(6)-pv*rn)*(ri-1)/(rn-1):an=t5
  293. 4210 an$=mid$(str$(int(an*100-int(an)*100)),2)
  294. 4220 if len(an$)=1 then an$="0"+an$
  295. 4230 an$="$"+str$(int(an))+"."+an$
  296. 4240 an=int(an+.5):goto4470
  297. 4250 an=10:da=4.95:g=0:a4=500
  298. 4260 if ny*r+pv<=0 then4450
  299. 4270 if fv(6)<ny*r+pv then4460
  300. 4280 ri=(1+an/100)^(1/12):rn=ri^ny:if a4>10 then a4=int(a4*.9)
  301. 4290 g2=pv*rn+r*(rn-1)/(ri-1):if int(g2*a4+.5)=fv(6)*a4 then4350
  302. 4300 if g2<fv(6) then4330
  303. 4310 an=an-da:if g=1 then da=da/2
  304. 4320 g=-1:goto4280
  305. 4330 an=an+da:if g=-1 then da=da/2
  306. 4340 g=1:goto4280
  307. 4350 an=fn r2(.001):an$=str$(an)+"%":goto4470
  308. 4360 if ny*r+pv<=0 then4450
  309. 4370 if fv(6)<ny*r+pv then4460
  310. 4380 if ri=1 then an=(fv(6)-pv)/r/12:goto4410
  311. 4390 z=ri-1:an=(fv(6)*z+r)/(z*pv+r)
  312. 4400 an=log(an)/log(ri):an=an/12
  313. 4410 an=fn r2(.1):an$=str$(an)+" years":goto4470
  314. 4420 if ri=1 then an=pv+r*ny:goto4440
  315. 4430 an=pv*rn+r*(rn-1)/(ri-1)
  316. 4440 an=int(an+.5):an$="$"+str$(an):goto4470
  317. 4450 an=fv(cy):an$="$ value 0"+er$:goto4470
  318. 4460 an=fv(cy):an$="negative result"+er$
  319. 4470 fv(cy)=an:gosub800
  320. 4480 printh$;left$(dn$,nr+3)
  321. 4490 printsp$:printsp$:printsp$:printsp$
  322. 4500 printu3$" calculated "fc$(cy):print" is :"an$
  323. 4510 gosub1860:on ra goto400,4090
  324. 4520 gosub600:goto4510
  325. 5000 rem--
  326. 5010 data "[204]oan payments",0," ",0
  327. 5020 data "[193]mount of loan",2,21003
  328. 5030 data "[201]nterest rate",1,11.89,0
  329. 5040 data "# of monthly payments",4,120,1,600
  330. 5050 data "[205]onthly payment",2,300
  331. 5060 data e
  332. 5070 zt=5000:lc=30:gosub1550
  333. 5080 printcd$:sf=0:af=1
  334. 5090 gosub580
  335. 5100 gosub1720
  336. 5110 gosub780
  337. 5120 on qa goto400,5130,5110
  338. 5130 p=fv(2):r=fv(5):ri=(1+fv(3)/100)^(1/12):i=1-ri:ny=fv(4):n=12:rn=ri^ny
  339. 5140 i2=fv(3)/100:i3=i2/n+1
  340. 5150 if ny=0 and cy<>4 then t=4:goto5390
  341. 5160 if fv(5)=0 and cy<>5 then t=5:goto5390
  342. 5170 if fv(2)=0 and cy<>2 then t=2:goto5390
  343. 5180 if p>r*ny and cy=3 thenan=fv(cy):an$="negative result"+er$:goto5410
  344. 5190 on cy-1 goto5200,5230,5320,5360
  345. 5200 if i3=1 then an=r*ny:goto5220
  346. 5210 an=r*n*(1-1/i3^ny)/i2
  347. 5220 an=int(an+.5):an$="$"+str$(an):goto5410
  348. 5230 sf=0:an=10:da=4.95:g=0:if r*ny=p then an=0:goto5310
  349. 5240 i2=an/100:i3=i2/n+1
  350. 5250 g2=(i2*p/n)/(1-1/i3^ny):if int(g2*50+.5)=r*50 then5310
  351. 5260 if g2<r then5290
  352. 5270 an=an-da:if g=1 then da=da/2
  353. 5280 g=-1:goto5240
  354. 5290 an=an+da:if g=-1 then da=da/2
  355. 5300 g=1:goto5240
  356. 5310 an=fn r2(.001):an$=str$(an)+"%":goto5410
  357. 5320 if i3=1 then an=p/r:goto5350
  358. 5330 if r<p*i3-p then an$="[205]onthly payment too small"+er$:an=fv(cy):goto5410
  359. 5340 an=log(-1/(p*i2/r/n-1))/log(i3)
  360. 5350 an=int(an+.5):an$=str$(an):goto5410
  361. 5360 if i3=1 then an=p/ny:goto5380
  362. 5370 an=(i2*p/n)/(1-1/i3^ny)
  363. 5380 an=fn rd(an):gosub1680:goto5410
  364. 5390 an=fv(cy):an$=fc$(t)
  365. 5400 an$=an$+" = 0"+er$
  366. 5410 fv(cy)=an:gosub800
  367. 5420 printh$;left$(dn$,nr+3)
  368. 5430 printsp$:printsp$:printsp$:printsp$
  369. 5440 printu3$" calculated "fc$(cy):print" is :"an$
  370. 5450 print:t$="to print payment schedule"
  371. 5460 gosub1850:on ra goto400,5080,5470,5480
  372. 5470 gosub600:goto5450
  373. 5480 printcd$"[197]nter date of first payment (_ cancel)":input" month (1-12)";m$
  374. 5490 if m$="_" then5080
  375. 5500 m=int(val(m$)):if m<1 or m>12 then5480
  376. 5510 input" year";yr$:yr=int(val(yr$)):if yr>100 then yr=yr-int(yr/100)*100
  377. 5520 gosub720:if t<0 then5080
  378. 5530 print"printing payment schedule..."
  379. 5540 open4,4:cmd4
  380. 5550 an=fv(2):gosub1760:printdc$" borrowed at "fv(3)"%":an=fv(5)
  381. 5560 print:printdc$"   #   date   principal   interest  balance due"
  382. 5570 p=fv(2):a=fv(5):ri=fv(3)/1200:if fv(4)=1 then5690
  383. 5580 for k=1 to fv(4)
  384. 5590 if k<100 then print" ";:if k<10 then print" ";
  385. 5600 printk;
  386. 5610 t$=dc$+str$(m)+"/":if yr<10 then t$=t$+"0"
  387. 5620 t$=t$+mid$(str$(yr),2):printleft$(sp$,7-len(t$));t$;
  388. 5630 m=m+1:if m>12 then m=1:yr=yr+1:if yr>99 then yr=0
  389. 5640 if k=fv(4) then next:goto5690
  390. 5650 t=p*ri:an=a-t:gosub1760
  391. 5660 an=t:gosub1760:print" ";
  392. 5670 p=p-a+t:an=p:gosub1760:print
  393. 5680 next
  394. 5690 t=p*ri:an=p:gosub1760
  395. 5700 an=t:gosub1760:an=0:gosub1760
  396. 5710 an=fv(5):print:printdc$" regular payments:";:gosub1760:print
  397. 5720 an=p+t:printdc$" last payment:";:gosub1760
  398. 5730 print#4:close4
  399. 5740 print"press f1, f3 to go back to loans, _ menu"
  400. 5750 gosub1870:on ra goto400,5080,5080
  401. 6000 rem--
  402. 6010 data "[198]ixed rate or adjustable rate mortgage",0," ",0
  403. 6020 data "[208]rincipal",2,86000
  404. 6030 data "[198]ixed rate mortgage",0
  405. 6040 data " [193]nnual % rate",1,10.86,1
  406. 6050 data " [208]oints",1,3,0
  407. 6060 data " # of years",4,30,1,40
  408. 6070 data "[193]djustable rate mortgage",0
  409. 6080 data " [201]nitial interest rate",1,8.93,1
  410. 6090 data " [208]oints",1,2,0
  411. 6100 data " [217]early cap",1,2,1
  412. 6110 data " [204]ifetime cap",1,14,1
  413. 6120 data " # of years",4,30,1,40
  414. 6130 data " ",0
  415. 6140 data ir
  416. 6150 data e
  417. 6160 zt=6000:lc=30:gosub1550
  418. 6170 printcd$:sf=0:gosub580
  419. 6180 gosub1840
  420. 6190 gosub780
  421. 6200 on qa goto400,6210,6190
  422. 6210 n=12:i2=fv(4)/100:i3=i2/n+1:ny=fv(6)*12:p=fv(2):y=fv(6):yy=fv(12)
  423. 6220 a2=(i2*p/n)/(1-1/i3^ny)
  424. 6230 i2=fv(8)/100:i3=i2/n+1:ny=fv(12)*12
  425. 6240 an=(i2*p/n)/(1-1/i3^ny):a(0)=an:w(0)=an
  426. 6250 mx=fv(11)/100:d=fv(10)/100:p(0)=p:q(0)=p:i2(0)=i2:w2(0)=i2
  427. 6260 cf(0)=fv(5)/100*p:cp(0)=fv(10)/100*p:cw(0)=cp(0):ny=yy*12
  428. 6270 y2=0:y4=0:ri=1+fv(14)/100
  429. 6280 for k=1 to 5:gosub6810:next
  430. 6290 rr=a2:print"[198]ixed rate payments are[160]";:gosub1670:print" a month."
  431. 6300 rr=an:print"[193][210][205][160]payments start at ";:gosub1670:print".  [201]f rates"
  432. 6310 rr=a(2):print"rise .5% a year, payments become ";:gosub1670:print
  433. 6320 rr=a(5):print"in 2 years, and ";:gosub1670:print" in 5 years."
  434. 6330 rr=w(2):print"[201]n the worst case, payments are ";:gosub1670:print
  435. 6340 rr=w(5):print"in 2 years, and ";:gosub1670:print" in 5 years."
  436. 6350 t$="for further analysis"
  437. 6360 gosub1850:on ra goto400,6170,6370,6380
  438. 6370 gosub600:goto6350
  439. 6380 if y<6 then6410
  440. 6390 ty=y-1:if yy>y then ty=yy-1
  441. 6400 gosub1770:for k=6 to ty+1:gosub6810:next
  442. 6410 printcd$;dc$"[193]djustable rate mortgages are great"
  443. 6420 print"if interest rates go down, and terrible"
  444. 6430 print"when rates skyrocket.  [193][210][205]s are also"
  445. 6440 print"good for people who move often."
  446. 6450 ifyy<>ythenprint"[195]omparisons invalid because lengths     differ.":goto6570
  447. 6460 if y2>0 then6490
  448. 6470 print"[212]he fixed rate mortgage is superior. [212]he";
  449. 6480 print"[193][210][205] makes sense if rates go down.":goto6570
  450. 6490 print"[201]f interest rates increase .5% a year"
  451. 6500 print"(a realistic and pessimistic scenario)"
  452. 6510 print"and you sell within"y2"years the [193][210][205]":print"is better.";
  453. 6520 if y4=0 then6570
  454. 6530 print"  [201]f rates rise quickly (up"
  455. 6540 print"yearly cap every year), you still"
  456. 6550 print"come out ahead if sell within"y4
  457. 6560 print"years."
  458. 6570 print:t$="to print cost analysis table"
  459. 6580 gosub1850:on ra goto400,6170,6590,6610
  460. 6590 gosub600:goto6570
  461. 6600 if a=95 then6170
  462. 6610 gosub720:if t=-1 then6170
  463. 6620 open4,4,7:cmd4
  464. 6630 rr=a2:printdc$"[198]ixed rate payments are ";:gosub1670:print
  465. 6640 if fv(6)=fv(12) then6660
  466. 6650 printdc$"[215][193][210][206][201][206][199]! cost comparison invalid because of term difference."
  467. 6660 print:printdc$"[195]umulative real costs and monthly payments":print
  468. 6670 printdc$"[217]r       [198]ixed       [210]ising rates       [215]orst case"
  469. 6680 printdc$"         costs       costs  payment     costs payment"
  470. 6690 for k=0 to ty
  471. 6700 printdc$;mid$(str$(k),2);
  472. 6710 if k<10 then print"[160]";
  473. 6720 rr=cf(k):gosub1640:rr=cp(k):gosub1640:rr=a(k):gosub1650
  474. 6730 rr=cw(k):gosub1640:rr=w(k):gosub1650:print:next:if y<>yy then6780
  475. 6740 print:printdc$"[207]ver the life of the"y"year mortgage the real costs are:"
  476. 6750 rr=cf(ty+1):gosub1640:printdc$" for the fixed rate mortgage"
  477. 6760 rr=cp(ty+1):gosub1640:printdc$" for the [193][210][205] with rising interest rates"
  478. 6770 rr=cw(ty+1):gosub1640:printdc$" for the worst case [193][210][205]"
  479. 6780 print#4:close4:printchr$(147)hr$"[208]ress f1, f3 another, _ menu":gosub1870
  480. 6790 if a=95 then400
  481. 6800 goto6170
  482. 6810 t=k-1:n4=ny-k*n
  483. 6820 h=n/ri^t:cf(k)=cf(t)+a2*h:cp(k)=cp(t)+a(t)*h:cw(k)=cw(t)+w(t)*h
  484. 6830 if cf(k)>cp(k) then y2=k
  485. 6840 if cf(k)>cw(k) then y4=k
  486. 6850 i2=i2(t)/12:w2=w2(t)/12:p=p(t):q=q(t):a=a(t):w=w(t)
  487. 6860 for j=1 to n
  488. 6870 p=p+p*i2-a:q=q+q*w2-w
  489. 6880 next j:q(k)=q:p(k)=p
  490. 6890 i2(k)=i2(t)+.005:if i2(k)>mx then i2(k)=mx
  491. 6900 w2(k)=w2(t)+d:if w2(k)>mx then w2(k)=mx
  492. 6910 if n4=0 then a(k)=0:w(k)=0:p(k)=0:q(k)=0:goto6950
  493. 6920 if k>y then cf(k)=cf(t)
  494. 6930 a(k)=(i2(k)*p(k)/n)/(1-1/(i2(k)/n+1)^n4)
  495. 6940 w(k)=(w2(k)*q(k)/n)/(1-1/(w2(k)/n+1)^n4)
  496. 6950 return
  497. 7000 rem--
  498. 7010 data "[204]ife insurance needs",0," ",0
  499. 7020 data "[212]otal household salary income",2,43000
  500. 7030 data "[217]our salary, before taxes",2,25000
  501. 7040 data "[193]nnual savings",2,2000
  502. 7050 data "[217]our age",4,42,0,99
  503. 7060 data "# of people in household",4,4,0,10
  504. 7070 data "[193]ge of youngest person",4,6,0,99
  505. 7080 data " ",0
  506. 7090 data "[195]ash, savings/checking acct.",2,1200
  507. 7100 data "[211]tocks, mutual funds",2,5000
  508. 7110 data "[200]ard asset investments",2,0
  509. 7120 data " ",0,"[200]ome mortgage",2,50000
  510. 7130 data "[195]ar loan",2,5000
  511. 7140 data "[195]onsumer debt",2,500
  512. 7150 data "[195]ollege fund",2,65000
  513. 7160 data "[195]haritable contributions",2,1000
  514. 7170 data "[195]urrent interest rate",1,9.35,0
  515. 7180 data e
  516. 7190 zt=7000:lc=38:gosub1550:if q2>0 then fv(16)=q2
  517. 7200 printcd$:sf=0
  518. 7210 gosub580
  519. 7220 gosub1840
  520. 7230 gosub780
  521. 7240 on qa goto400,7250,7230
  522. 7250 if fv(2)<fv(3) then printfc$(2)" [204][197][211][211][160][212][200][193][206]":printfc$(3);er$:goto7520
  523. 7260 fe=.6*fv(3):if fe<6000 then fe=6000
  524. 7270 ca=fv(9)+fv(10)*.9+fv(11)*.8:cd=fv(13)+fv(14)+fv(15)+fv(16)
  525. 7280 if fv(6)<2 then an=fe-ca+cd:goto7400
  526. 7290 re=fv(3)-fv(2)/(fv(6)+.5)-fv(4)*fv(3)/fv(2):i=fv(18)+1:if i<2.5 then i=2.5
  527. 7300 r2=re*2:if fv(3)<4000 or fv(5)<25 or fv(6)<2 or fv(7)>18 then7330
  528. 7310 t4=fv(3):if t4>37000 then t4=37000
  529. 7320 re=re-4000-(fv(6)>3)*1400-t4/15
  530. 7330 ip=re/i*100+r2:if ip<0 then ip=0:goto7360
  531. 7340 if fv(7)<10 then ip=ip*(1+(10-fv(7))/33)
  532. 7350 if fv(7)>12 and fv(7)<21 then ip=ip*(1-(fv(7)-12)/33)
  533. 7360 t=fv(3)/(fv(2)+1)
  534. 7370 an=ip+fe-ca*t+cd*sqr(t)+fv(17):if fv(6)>2and ip<1then an=an+(fv(6)-2)*2500
  535. 7380 if an>100000 then an=fn r2(5000):goto7410
  536. 7390 if an>50000 then an=fn r2(2500):goto7410
  537. 7400 an=fn r2(1000)
  538. 7410 printsp$:printsp$:printu3$
  539. 7420 if an<1000 then print"[217]ou may not need any life insurance.":goto7520
  540. 7430 print"[217]ou should have about $";str$(an)
  541. 7440 print"in life insurance coverage.  [204]ook into"
  542. 7450 t$="universal life":a=fv(5):t=an/fv(2)
  543. 7460 if t>10 or (t>8 and an>30) or (t>6 and a>35) then t$="term life":goto7490
  544. 7470 t=fv(2)/fv(4):if t<5 or (t<6 and a<35) then t$="term life":goto7490
  545. 7480 if a<35 or (a<55 and fv(4)<1000) then t$="term life or universal life"
  546. 7490 if fv(3)>75000 and fv(4)<fv(2)/50 and ca<fv(3) then t$="whole life"
  547. 7500 if fv(4)<fv(2)/25 and fv(5)>45 and ca<fv(2) then t$="whole life"
  548. 7510 print"a "t$" policy."h$
  549. 7520 gosub1860:on ra goto400,7200
  550. 7530 gosub600:goto7520
  551. 8000 rem--
  552. 8010 data "[210]efinancing a mortgage",0," ",0
  553. 8020 data "[195]urrent financing",0
  554. 8030 data " [195]urrent balance",2,65000
  555. 8040 data " [193]nnual % rate",1,12.5,1
  556. 8050 data " # payments due",4,300,1,480
  557. 8060 data " ",0,"[211]uggested refinancing",0
  558. 8070 data " [208]rincipal",2,65000
  559. 8080 data " [193]nnual % rate",1,10.86,1
  560. 8090 data " # payments",4,360,1,600
  561. 8100 data " [208]oints",1,3,0
  562. 8110 data " [207]ther closing costs",2,2500
  563. 8120 data " [208]repayment penalty",2,0
  564. 8130 data "[212]ax bracket",1,28,0
  565. 8140 data "[201]nterest and points deductible",3,1
  566. 8150 data ir
  567. 8160 data e
  568. 8170 zt=8000:lc=37:gosub1550
  569. 8180 printcd$:sf=0:gosub580
  570. 8190 gosub1840
  571. 8200 gosub780
  572. 8210 on qa goto400,8220,8200
  573. 8220 p=fv(3):q=fv(8):i2=fv(4)/100:w2=fv(9)/100:d=1-fv(15)*fv(14)/10000
  574. 8230 ny=fv(5):n4=fv(10):ps=p:n=12
  575. 8240 pt=(fv(11)*d-fv(11))/n4
  576. 8250 cf=0:cw=fv(13)+fv(12)+fv(11)
  577. 8260 ty=ny:if ty<n4 then ty=n4
  578. 8270 a=(i2*p/n)/(1-1/(i2/n+1)^ny):av=a*d
  579. 8280 ri=(1+i2)^(1/n):r2=(1+w2)^(1/n):r4=(1+fv(16)/100)^(1/n)
  580. 8290 w=(w2*q/n)/(1-1/(w2/n+1)^n4):wv=w*d+pt:an=0
  581. 8300 for k=1 to ty
  582. 8310 p=p*ri-a:q=q*r2-w:rk=r4^k
  583. 8320 cf=cf+av/rk:cw=cw+wv/rk
  584. 8330 tp=cf-(ps-p)/rk:tq=cw-(ps-q)/rk
  585. 8340 if tq<tp and an=0 then an=k
  586. 8350 if k/12=int(k/12) then t=k/12:p(t)=tp:q(t)=tq
  587. 8360 next
  588. 8370 print"[212]he payments on refinancing will be"
  589. 8380 if abs(a-w)<.5 then print"about the same as the old payments.":goto8420
  590. 8390 if a>w then rr=a-w:gosub1670:print" less than the old payments."
  591. 8400 if a<w then rr=w-a:gosub1670:print" more than the old payments."
  592. 8410 if an>0 then8440
  593. 8420 print"[210]efinancing with these terms costs you"
  594. 8430 print"money, so you probably shouldn't do it.":goto8470
  595. 8440 an=an/12:print"[217]ou must wait "fn r2(.1)"years for"
  596. 8450 print"the refinancing to be better than the"
  597. 8460 print"existing mortgage."h$
  598. 8470 gosub1860:on ra goto400,8180
  599. 8480 gosub600:goto8470
  600. 9000 rem--
  601. 9010 data "[201][210][193] [208]lanner",0," ",0
  602. 9020 data "[217]our age",4,42,0,65
  603. 9030 data "[195]urrent [201][210][193][160]balance",2,7100
  604. 9040 data "[212]his year's contribution",2,2000
  605. 9050 data "[197]stimated annual yield",1,9.23,0
  606. 9060 data "[195]urrent tax bracket",1,28,0
  607. 9070 data "[197]arly withdrawal penalty",1,10,0
  608. 9080 data "% of contribution deductible",1,100,0
  609. 9090 data "[210]etirement age",4,67,0,70
  610. 9100 data "[212]ax bracket when you withdraw",1,33,0
  611. 9110 data ir,e
  612. 9120 zt=9000:lc=36:gosub1550
  613. 9130 printcd$:sf=0
  614. 9140 gosub580
  615. 9150 gosub1840
  616. 9160 gosub780
  617. 9170 on qa goto400,9180,9160
  618. 9180 if fv(9)<=fv(2) then printfc$(2)" [199][210][197][193][212][197][210][160][212][200][193][206] "fc$(9):printer$:goto9420
  619. 9190 y=fv(9)-fv(2):ri=1+fv(5)*(100-fv(6))/10000
  620. 9200 r2=(100-fv(6))/100:r3=(100-fv(10))/100:i=1+fv(5)/100
  621. 9210 i2=fv(4)*i^y-fv(4):dr=fv(8)/100:nd=fv(4)-fv(4)*dr:dd=fv(4)*dr
  622. 9220 an=i2*r3+dd*r3-nd*r2*ri^y+nd:t3=fv(4)*r2:a2=ri^y*t3
  623. 9230 print"[195]ontribution will be worth $"int(an+.5)
  624. 9240 print"(after taxes) when you retire."
  625. 9250 print"[195]ompared to $"int(a2+.5)"outside the [201][210][193].":t=(100-fv(7))/100
  626. 9260 printr$"still calculating"
  627. 9270 t6=fv(3)*i^y*r3                         
  628. 9280 t3=fv(4)*r2:an=0
  629. 9290 for k=1 to y
  630. 9300 t4=(fv(4)*i^k-fv(4))*r3+dd*r3-nd*r2*ri^k+nd
  631. 9310 t6=t6+t4:if k+fv(2)>59 then t=1
  632. 9320 t8=t4-nd:t8=t8*t:t8=t8+nd
  633. 9330 t5=t3*ri^k:if t8>t5 and an=0 then an=k:t7=t4
  634. 9340 next
  635. 9350 printu$"[201]f you contribute this amount every"
  636. 9360 print"year you will have[160]$"int(t6)"when you"
  637. 9370 print"retire (after paying taxes).  [212]his will"
  638. 9380 print"be worth $"int(t6/(1+fv(11)/100)^y)"after inflation."
  639. 9390 if an=0 then print"[193]n [201][210][193][160]may not be right for you.":goto9420
  640. 9400 print"[201]t will take"an"years before early"
  641. 9410 print"withdrawals are profitable."
  642. 9420 gosub1860:on ra goto400,9130
  643. 9430 gosub600:goto9420
  644.