home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1989 July
/
1989-07.d64
/
planner
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
21KB
|
644 lines
10 rem copyright 1989 compute! publications, inc. - all rights reserved
20 printchr$(147);chr$(14);chr$(8):poke53281,0:poke53280,11:poke646,13
30 printspc(12)"[195]opyright 1989":print spc(6)"[195][207][205][208][213][212][197]! [208]ublications, [201]nc."
40 print spc(10)"[193]ll rights reserved."
50 sa=52224:if peek(sa)=169 and peek(sa+206)=96 then clr:goto250
60 h1=int((sa+13)/256):l1=(sa+13)-h1*256
70 h2=int((sa+150)/256):l2=(sa+150)-h2*256:cs=0
80 for ad=satosa+206:readml:cs=cs+ml:pokead,ml:next
90 if cs<>23175 then print chr$(147)"error in ml data":end
100 poke sa+5,l1:poke sa+9,h1:poke sa+133,l2:poke sa+138,h2
110 sys sa:clr
120 data 169,76,133,124,169,13,133,125,169,192,133,126,96,141,255,3
130 data 104,141,252,3,104,141,253,3,72,173,252,3,72,201,217,208
140 data 7,173,253,3,201,183,240,11,173,255,3,201,58,176,3,76
150 data 128,0,96,104,169,220,72,186,142,254,3,165,113,141,248,3
160 data 165,114,141,249,3,162,79,189,0,2,157,167,3,202,16,247
170 data 56,165,36,229,122,168,162,23,201,81,176,73,169,0,141,13
180 data 3,153,0,2,136,177,122,153,0,2,136,16,248,169,0,133
190 data 122,169,2,133,123,32,121,165,173,0,3,141,250,3,173,1
200 data 3,141,251,3,169,150,141,0,3,169,192,141,1,3,32,115
210 data 0,32,138,173,162,0,173,250,3,141,0,3,173,251,3,141
220 data 1,3,173,13,3,138,141,13,3,240,6,169,0,133,97,133
230 data 102,173,248,3,133,113,173,249,3,133,114,162,79,189,167,3
240 data 157,0,2,202,16,247,169,0,133,13,174,254,3,154,96,0
250 dn$="":lt$="":sp$=" ":dc$=dn$:hd$="":hr$=hd$+"":h$="":r$=""
260 cd$="[147]":c2$=cd$+dc$:u$="[145]":u3$=u$+u$+u$:er$=" "+r$+"error"
270 for i=1 to 6:dn$=dn$+dn$:lt$=lt$+lt$:sp$=sp$+sp$:next
280 dn$=left$(dn$,24):lt$=left$(lt$,40):sp$=left$(sp$,39)
290 dim c%(255),fc$(22),fc%(22),fv(22),v2(22),zf(22):printchr$(14)
300 dim cf(50),cp(50),cw(50),a(50),w(50),p(50),q(50),i2(50),w2(50),tp(39)
310 poke 784,108:poke785,122:poke786,0
320 def fn rs(ln)=usr(ln)+pos(" [184] [163][168][168][198]_[165]_l'[168]")
330 t=fn rs(360)
340 for k=1 to 12:read a:c%(a)=k:next
350 for k=49 to 58:c%(k)=10:next:c%(17)=5:c%(32)=7
360 data 67,95,133,134,13,145,147,20,46,48,89,78
370 poke 784,108:poke785,122:poke786,0
380 def fn r2(rr)=int(an/rr+.5)*rr
390 def fn rd(rr)=int(rr*100+.5)/100
400 printcd$
410 printhd$;dc$"[198]inancial [208]lanner";dc$:print"[208]ress # of option";dc$
420 print"1. [195]ollege planning"
430 print"2. [195]ar buy/lease"
440 print"3. [195]ompound interest/savings"
450 print"4. [204]oan payments"
460 print"5. [198]ixed/adjustable rate mortgage"
470 print"6. [200]ow much life insurance do you need?"
480 print"7. [211]hould you refinance your mortgage?"
490 print"8. [201][210][193][160]planning":af=0
500 geta$:if a$="" then500
510 c=c%(asc(a$)):if c=1 then gosub930:goto410
520 if c=2 then printchr$(147):end
530 if c<>10 then400
540 printdc$;r$"[210]eading data statements ..."
550 on val(a$) goto2000,3000,4000,5000,6000,7000,8000,9000
560 goto400
570 rem--
580 for i=0 to nr:printfc$(i);:gosub820:next:return
590 rem print screen subroutine
600 rr=1104:px=0:py=0:my=22:for ty=22 to 10 step-1
610 if peek(rr+ty*40)<>32 or peek(rr+ty*40+1)<>32 then my=ty:ty=10
620 next:gosub1940:gosub720:if t<0 then710
630 printhr$"[208][210][201][206][212][201][206][199] ...":open7,4,7
640 for i=0 to my:t$=dc$:h=-2
650 for j=0 to 39:a=peek(rr+i*40+j) and 127:if a=96 then a=32:goto690
660 if a>0 and a<27 then a=a+64:goto680
670 if a>64 and a<91 then a=a+128
680 if a<>32 then h=j
690 t$=t$+chr$(a):next
700 t$=left$(t$,h+2):print#7,t$:next:close7
710 gosub1950:return
720 open7,4,7:close7:t=st
730 open7,4:if st=t then close7:return
740 printhd$sp$:printu$"[208]rinter not ready, press _ to cancel"
750 geta$:if a$="_" then t=-1:close7:return
760 if a$="" then t=t+1:if t<9 then750
770 t=0:printhd$;sp$:close7:goto720
780 gosub1070:if qa=2 then return
790 t$=t2$
800 printh$;left$(dn$,cy+2);fc$(cy);tab(lc-9);left$(sp$,9)
810 printh$;left$(dn$,cy+2);fc$(cy);:i=cy
820 if fc%(i)=0 then print:return
830 on fc%(i) gosub850,880,890,910
840 print tab(lc-len(t$)-(1=fc%(i)));t$:return
850 if sf=0 then t$=mid$(str$(fv(i)),2,6)+"%":return
860 t$=t2$+"%":if t2$="" then t$="0%"
870 return
880 t$="$"+mid$(str$(int(fv(i)+.5)),2):return
890 t$="no":if fv(i) then t$="yes"
900 return
910 t$=mid$(str$(int(fv(i))),2):return
920 rem calculator subroutine
930 printh$;sp$
940 t=0:a2$="":t$=hd$+sp$+"[145]":printt$:if cc$<>"" then a2$=str$(val(cc$))
950 printt$:for t2=0 to t:next:print"?"a2$
960 geta$:if a$<>"" then990
970 t=t+1:if t>199 then t=0:goto950
980 goto960
990 t=0:a=asc(a$):if a=13 then cc$=a2$:goto930
1000 if(a>38 and a<58 and a<>44) or a=94 then a2$=left$(a2$+a$,38):goto950
1010 if a=95 or a=67 then printh$;sp$:printsp$:return
1020 if a=20 then if len(a2$) then a2$=left$(a2$,len(a2$)-1):goto950
1030 if a=147 or a=19 then a2$="":goto950
1040 if a<>81 and a<>69 and a<>61 then960
1050 print t$;h$;sp$:if len(cc$)<21 then printh$;cc$" =";
1060 printval(cc$):return
1070 if fc%(cy)<>0 then1100
1080 sf=0:gf=0:gosub1420:cy=cy+1:if cy>nr then cy=0
1090 goto1070
1100 if sf=0 then t2$=mid$(str$(fv(cy)),2):sf=1
1110 printh$;left$(dn$,cy+2);r$;:i=cy:gosub820:qa=3
1120 geta$:if a$="" then1120
1130 a=asc(a$)
1140 on c%(a) goto1160,1170,1180,1120,1190,1230,1270,1290,1370,1400,1330,1350
1150 goto1120
1160 gosub930:goto1120
1170 qa=1:return
1180 qa=2:gosub1770:return
1190 if a<>17 and a<>13 then1230
1200 gosub800:gf=0:gosub1420:cy=cy+1:sf=0:if cy>nr then cy=0
1210 if fc%(cy)=0 then1200
1220 return
1230 gosub800
1240 gf=0:gosub1420:cy=cy-1:sf=0:if cy<0 then cy=nr
1250 if fc%(cy)=0 then1240
1260 return
1270 if a=147 or (a=32 and fc%(cy)<>3) then t2$="":fv(cy)=0:return
1280 goto1320
1290 if len(t2$)<2 then t2$="":fv(cy)=0:return
1300 t2$=left$(t2$,len(t2$)-1):fv(cy)=val(t2$):return
1310 rem
1320 fv(cy)=1-fv(cy):return
1330 if fc%(cy)=3 then fv(cy)=1
1340 return
1350 if fc%(cy)=3 then fv(cy)=0
1360 return
1370 if fc%(cy)<>1 then return
1380 for j=1 to len(t2$):if mid$(t2$,j,1)=chr$(46) then j=7:next:return
1390 next j
1400 if gf=0 then gf=1:t2$=a$:fv(cy)=val(t2$):return
1410 t2$=left$(t2$+a$,7):fv(cy)=val(t2$):return
1420 if fc%(cy)=0 then return
1430 if fc%(cy)<>1 then1500
1440 t$=hd$+sp$+hd$+"[215][193][210][206][201][206][199] - % rate "
1450 if fv(cy)>100 then printt$;"greater than 100":return
1460 if fv(cy)=0 then printt$;"is zero":return
1470 if v2(cy)>0 and fv(cy)>v2(cy)*2+4 then printt$;"very high":return
1480 if v2(cy)>0 and fv(cy)<.1 then printt$"very low":return
1490 goto1540
1500 if fc%(cy)<>4 then1540
1510 t$=hd$+sp$+hd$+"[215][193][210][206][201][206][199] - # is[160]"
1520 if fv(cy)=0 thenprintt$;"zero":return
1530 if v2(cy)>0 and fv(cy)>v2(cy) thenprintt$;"extremely large":return
1540 printhd$;sp$:return
1550 if qt=zt then return
1560 qt=zt:t=fn rs(zt):i=0
1570 zf(i)=0:read fc$(i):if fc$(i)="e" then nr=i-1:return
1580 if fc$(i)<>"ir" then1600
1590 fc$(i)="[201]nflation rate":fc%(i)=1:fv(i)=4.4:v2(i)=5:goto1630
1600 v2(i)=-1:read fc%(i):if fc%(i) then read fv(i):v2(i)=fv(i)
1610 if fc%(i)=4 or fc%(i)=1 then read zf(i)
1620 if fc%(i)=4 then read v2(i)
1630 i=i+1:goto1570
1640 r4=12:goto1660
1650 r4=7
1660 t$="$"+mid$(str$(int(rr+.5)),2):printleft$(sp$,r4-len(t$));t$;:return
1670 print"$"mid$(str$(int(rr+.5)),2);:return
1680 an$="$"+mid$(str$(an),2)
1690 if an=int(an) then an$=an$+".00":return
1700 if abs(an*10-int(an*10+.5))<.001 then an$=an$+"0"
1710 return
1720 print:print"[195]hange any or all values, then move"
1730 print"cursor to the number you want"
1740 print"calculated and press f1."
1750 cy=2:sf=0:return
1760 an=fn rd(an):gosub1680:printleft$(sp$,11-len(an$));an$;:return
1770 printh$;left$(dn$,nr+4);:for rr=nr+4 to 23:printsp$:next
1780 print h$;left$(dn$,nr+4):if af=1 then fv(cy)=.01
1790 for k=2 to nr:if zf(k)=0 or fv(k)>00 then1820
1800 printfc$(k)" = 0";er$:k=nr:qa=3
1810 print" [195]hange value then f1 calc, _ menu"
1820 next:if qa=3 then return
1830 print h$;left$(dn$,nr+4);r$"calculating..."u$:sf=0:return
1840 print:print"[197]nter all values then press f1 to calc":cy=2:sf=0:return
1850 printhr$u$"[208]ress f5 ";t$:pf=-1
1860 printhr$"[208]ress f1 another, f3 print, _ menu":gf=0
1870 geta$:if a$="" then1870
1880 a=asc(a$):if a=67 then gosub1940