home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 28
/
028.d81
/
investor
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
11KB
|
341 lines
0 rem open3,8,3,"files"
1 rem get#3,a$:ifst<>.thenclose3:end
2 rem printa$;:goto1
4 gosub60100:clr:bk$="[164]":printchr$(142):dimg$(20)
5 poke53280,1:poke53281,1:r$=chr$(13)
10 dima$(40),b$(40),c(40),cc(40),d(40),e(40),f(40),g(40),h(40),p(40)
15 dimcg(40),gg(40)
17 print"[147][144] the investor"
20 print"[144]today's date is mm/dd/yy:";bk$;
22 nc=8:mo=130:gosub60500
23 ifa$=""then20
24 td$=a$
25 x=1
30 print"[147][144]";spc(14)"the investor[146]"
35 printspc(4)"(1) update old file"
40 printspc(4)"(2) create new file"
44 print
45 printspc(4)"(3) return to loadstar"
50 print" choose 1, 2, or 3:"
55 poke198,0:wait198,1:getz$:ifz$="1"then125
60 ifz$="2"then65
61 ifz$="3"then60000
63 goto55
65 print"[147]";spc(14)"create file[146]"
70 i=1
75 ifi=1thengoto85
80 print"[147]previous=";a$(i-1):print"[146]"
85 print"name of investment:";bk$;:mo=146:nc=20:gosub60500:a$(i)=a$
86 ifa$=""then85
90 print"date bought mm/dd/yy:";bk$;:mo=130:nc=8:gosub60500:b$(i)=a$
93 ifa$=""then90
95 print"# shares:";bk$;:nc=8:mo=2:gosub60500:d(i)=val(a$)
97 ifa$=""then95
100 print"price per share:$";bk$;:nc=9:mo=130:gosub60500:p(i)=val(a$)
103 ifa$=""then100
105 c(i)=d(i)*p(i)
110 print"commission charge:$";bk$;:nc=9:mo=130:gosub60500
111 cc(i)=val(a$)
113 ifa$=""then110
115 print"more? y/n":poke198,0:wait198,1:getz$:ifz$="y"orz$="[217]"theni=i+1:goto80
117 ifz$<>"n"andz$<>"[206]"thenprint"[145]";:goto115
120 i=i+1:goto385
125 print"[147]";spc(17)"update[146]"
128 print"file name=";bk$;:nc=16:mo=146:gosub60500:n$=a$
130 print"[147]":printspc(7)"load from t[146]ape or d[146]isk[146]?"
135 poke198,0:wait198,1:getz$:ifz$="t"orz$="[212]"then170
136 ifz$<>"d"andz$<>"[196]"then130
137 open15,8,15,"r0:"+n$+"="+n$:input#15,er:close15
138 ifer=63then140
139 print"file not found.":fora=1to1000:next:goto30
140 open1,8,2,+n$+",s,r"
145 i=1
150 input#1,a$(i),b$(i),c(i),cc(i),d(i)
155 i=i+1
160 ifst=0goto150
165 close1:print"[147]";spc(14)"file loaded":goto210
170 printspc(17)"update"
175 open1,1,0,n$
180 i=1
185 input#1,a$(i),b$(i),c(i),cc(i),d(i)
190 i=i+1
195 ifst=0goto185
200 close1:print"[147]":printspc(14)"file loaded"
205 printspc(11)"press stop on tape[146]"
210 printspc(7)"update before printing out[146]"
215 printspc(8)"1=update investment"
220 printspc(8)"2=add an investment"
225 printspc(8)"3=delete an investment"
230 printspc(8)"4=file complete"
235 printspc(8)"5=error correction"
240 printspc(8)"6=stock sold"
245 printspc(8)"7=cap gain data"
246 printspc(8)"8=return to loadstar"
250 print" choose 1-8: [157]";bk$;:nc=1:mo=2:gosub60500:z=val(a$)
255 onzgoto260,445,450,385,490,770,935,60000
257 print"[145]";:goto250
260 forx=1toi-1
265 e(x)=((c(x)*.1)+c(x))/d(x)
270 e1=int(e(x)*100)/100
275 ife(x)>=e1+.005thene(x)=e1+.001
280 ife(x)<=e1+.005thene(x)=e1
285 f(x)=((c(x)*.2)+c(x))/d(x)
290 f1=int(f(x)*100)/100
295 iff(x)>=f1+.005thenf(x)=f1+.001
300 iff(x)<=f1+.005thenf(x)=f1
305 g(x)=((c(x)*.3)+c(x))/d(x)
310 g1=int(g(x)*100)/100
315 ifg(x)>=g1+.005theng(x)=g1+.001
320 ifg(x)<=g1+.005theng(x)=g1
325 h(x)=((c(x)*.4)+c(x))/d(x)
330 h1=int(h(x)*100)/100
335 ifh(x)>=h1+.005thenh(x)=h1+.001
340 ifh(x)<=h1+.005thenh(x)=h1
345 print"[147]";spc(5)"computing capital gain (loss)":printa$(x)
350 print"current price per share=";bk$;:mo=130:nc=9:gosub60500:cp(x)=val(a$)
355 cg(x)=(cp(x)*d(x))-c(x)
360 pg(x)=(cg(x)/c(x))*100:xt=pg(1)
362 pg(x)=int(pg(x)/.1):pg(x)=pg(x)*.1
365 tc=c(x)+tc
370 pr=cg(x)+pr
375 next
380 tg=(pr/tc)*100:tg=int(tg/.1):tg=tg*.1
385 print"[147]":printspc(8)"1=print hard copy":printspc(8)"2=save to tape"
390 printspc(8)"3=save to disk":printspc(8)"4=print to screen":
395 printspc(8)"5=rerun program":printspc(8)"6=error correction"
396 printspc(8)"7=return to loadstar"
397 print" choose 1-7: [157]";bk$;:mo=2:nc=1:gosub60500:z=val(a$)
400 onzgoto590,405,675,710,765,490,60000
402 print"[145]";:goto396
405 printspc(9)"load data tape[146]"
410 print"file name=";bk$;:nc=16:mo=144:gosub60500:n$=a$
415 open1,1,2,n$
420 fory=1toi-1
425 print#1,a$(y);r$;b$(y);r$;c(y);r$;cc(y);r$;d(y)
430 nexty
435 printspc(13)"file complete"
440 close1:goto210
445 goto80
450 printspc(15)"[147]delete an investment"
455 forx=1toi-1:printspc(10)x;a$(x):next
460 print"number to delete:";bk$;:nc=3:mo=2:gosub60500:z=val(a$)
465 forx=ztoi
470 a$(x)=a$(x+1):b$(x)=b$(x+1):c(x)=c(x+1):cc(x)=cc(x+1):d(x)=d(x+1)
475 next
480 print"more to delete? y/n":poke198,0:wait198,1:getz$:ifz$="y"orz$="[217]"then450
481 ifz$<>"n"anda$<>"[206]"thenprint"[145]";:goto480
485 goto915
490 printspc(12)"[147]error correction[146]"
495 forx=1toi-1:printx;a$(x):next
500 print"correct which? ->";bk$;:mo=2:nc=3:gosub60500:m%=val(a$)
505 printspc(8)"1[146] name"
510 printspc(8)"2[146] date bought"
515 printspc(8)"3[146] # shares"
520 printspc(8)"4[146] price"
525 printspc(8)"5[146] commission"
530 print"correcting ";a$(m%);
533 print"choose 1-5:";bk$;:nc=1:mo=2:gosub60500:c=val(a$)
535 oncgoto540,550,560,570,580
540 printa$(m%)"-change name to:";bk$;:nc=20:mo=146:gosub60500:a$(m%)=a$
545 goto385
550 printa$(m%):print"-change date mm/dd/yy ";b$(m%);" to:";bk$;
553 mo=130:nc=8:gosub60500:b$(m%)=a$
555 goto385
560 printa$(m%):print"-change # of shares ";d(m%);" to:";bk$;
563 mo=2:nc=8:gosub60500:d(m%)=val(a$)
565 goto385
570 printa$(m%):print"-change price $"p(m%);" to:";bk$;
573 mo=130:nc=9:gosub60500:p(m%)=val(a$)
575 c(m%)=(d(m%)*p(m%)):goto385
580 printa$(m%):print"-change commission cost $"cc(m%);" to:";bk$;
583 mo=130:nc=9:gosub60500:cc(m%)=val(a$)
585 goto385
590 print"[147]";spc(9)"printing a hard copy"
591 open15,4,15:close15:ifst=0then600
592 print"your printer isn't online."
593 print"[144]check it out and try again."
594 print"press [return] to continue."
595 geta$:ifa$<>chr$(13)then595
596 goto385
600 open4,4:cmd4:printtd$:print
605 fory=1toi-1
610 print#4,y;a$(y);" bought on ";b$(y);" @ $";(c(y)/d(y));
612 print#4,"/share";" #shares=";d(y)
615 print#4,"current price= $";cp(y):print#4,"commission cost= $";cc(y)
620 print#4,"10% profit @ $";e(y):print#4,"20% profit @ $";f(y)
625 print#4,"30%[160]profit @ $";g(y):print#4,"40% profit @ $";h(y)
630 print#4,"current capital gain= $";cg(y)
635 print#4,"amount invested = $";c(y)
640 print#4,"current value = $";(c(y)+cg(y))
645 print#4,"current percent gain=";pg(y);"%"
650 print#4:next
655 print#4:print#4,"total amount invested =$";tc
660 print#4,"total capital gain =$";pr
665 print#4,"total percent gain ="tg;"%":print
670 print#4,chr$(12):print#4:close4:print"[147]":goto210
675 print"[147]";spc(5)"writing investment data to disk[146]"
680 print"file name=";bk$;:mo=146:nc=16:gosub60500:n$=a$
685 open1,8,2,"@0:"+n$+",s,w"
690 fory=1toi-1
695 print#1,a$(y);r$;b$(y);r$;c(y);r$;cc(y);r$;d(y)
700 next
705 close1:print"[147]":goto210
710 print"[147]have you updated? y/n":poke198,0:wait198,1
712 getz$:ifz$="n"then260
715 print"[147]";spc(8)"copy in your record book[146]"
720 fory=1toi-1
722 ifa$(y)="0 "then755
725 print"";y;a$(y):print"bought on ";b$(y);" @ $";(c(y)/d(y));"/share"
730 print" #shares=";d(y):print"price= $";cp(y)
732 print"commission cost= $";cc(y)
735 print"10% profit @ $";e(y):print"20% profit @ $";f(y)
740 print"30% profit @ $";g(y):print"40% profit @ $";h(y)
745 print"press return to continue"
750 geta$:ifa$<>chr$(13)then750
755 next
760 print"[147]":goto210
765 run
770 print"[147]have you created a capital gain file for this year? y/n"
775 poke198,0:wait198,1:getz$:ifz$="y"orz$="[217]"then935
778 ifz$<>"n"anda$<>"[206]"then775
780 forx=1toi-1:printx,left$(a$(x),8),:next:printchr$(13)
785 print"which investment has been sold:";bk$;
787 mo=2:nc=3:gosub60500:z=val(a$)
790 n=n+1
795 ag$(n)=a$(z):bg$(n)=b$(z):cd(n)=c(z):dg(n)=d(z)
797 ca(n)=cg(z):gg(n)=cc(z)
800 print"sold @:$";bk$;:mo=130:nc=9:gosub60500:sa(n)=val(a$)
805 gc(n)=(sa(n)*dg(n))-cd(n):ag=ag+gc(n)
810 print"date sold mm/dd/yy:";bk$;:mo=130:nc=8:gosub60500:sd$(n)=a$
815 printspc(7)"capital gain data for year"
820 print"file name=";bk$;:mo=146:nc=16:gosub60500:n$=a$
825 printspc(10)"[147]save to t[146]ape or d[146]isk"
830 poke198,0:wait198,1:getz$:ifz$="d"o