home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1989 July / 1989-07.d64 / planner (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  21KB  |  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