home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 28 / 028.d81 / investor (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  11KB  |  341 lines

  1. 0 rem open3,8,3,"files"
  2. 1 rem get#3,a$:ifst<>.thenclose3:end
  3. 2 rem printa$;:goto1
  4. 4 gosub60100:clr:bk$="[164]":printchr$(142):dimg$(20)
  5. 5 poke53280,1:poke53281,1:r$=chr$(13)
  6. 10 dima$(40),b$(40),c(40),cc(40),d(40),e(40),f(40),g(40),h(40),p(40)
  7. 15 dimcg(40),gg(40)
  8. 17 print"[147][144]           the investor"
  9. 20 print"[144]today's date is mm/dd/yy:";bk$;
  10. 22 nc=8:mo=130:gosub60500
  11. 23 ifa$=""then20
  12. 24 td$=a$
  13. 25 x=1
  14. 30 print"[147][144]";spc(14)"the investor[146]"
  15. 35 printspc(4)"(1) update old file"
  16. 40 printspc(4)"(2) create new file"
  17. 44 print
  18. 45 printspc(4)"(3) return to loadstar"
  19. 50 print"    choose 1, 2, or 3:"
  20. 55 poke198,0:wait198,1:getz$:ifz$="1"then125
  21. 60 ifz$="2"then65
  22. 61 ifz$="3"then60000
  23. 63 goto55
  24. 65 print"[147]";spc(14)"create file[146]"
  25. 70 i=1
  26. 75 ifi=1thengoto85
  27. 80 print"[147]previous=";a$(i-1):print"[146]"
  28. 85 print"name of investment:";bk$;:mo=146:nc=20:gosub60500:a$(i)=a$
  29. 86 ifa$=""then85
  30. 90 print"date bought mm/dd/yy:";bk$;:mo=130:nc=8:gosub60500:b$(i)=a$
  31. 93 ifa$=""then90
  32. 95 print"# shares:";bk$;:nc=8:mo=2:gosub60500:d(i)=val(a$)
  33. 97 ifa$=""then95
  34. 100 print"price per share:$";bk$;:nc=9:mo=130:gosub60500:p(i)=val(a$)
  35. 103 ifa$=""then100
  36. 105 c(i)=d(i)*p(i)
  37. 110 print"commission charge:$";bk$;:nc=9:mo=130:gosub60500
  38. 111 cc(i)=val(a$)
  39. 113 ifa$=""then110
  40. 115 print"more? y/n":poke198,0:wait198,1:getz$:ifz$="y"orz$="[217]"theni=i+1:goto80
  41. 117 ifz$<>"n"andz$<>"[206]"thenprint"[145]";:goto115
  42. 120 i=i+1:goto385
  43. 125 print"[147]";spc(17)"update[146]"
  44. 128 print"file name=";bk$;:nc=16:mo=146:gosub60500:n$=a$
  45. 130 print"[147]":printspc(7)"load from t[146]ape or d[146]isk[146]?"
  46. 135 poke198,0:wait198,1:getz$:ifz$="t"orz$="[212]"then170
  47. 136 ifz$<>"d"andz$<>"[196]"then130
  48. 137 open15,8,15,"r0:"+n$+"="+n$:input#15,er:close15
  49. 138 ifer=63then140
  50. 139 print"file not found.":fora=1to1000:next:goto30
  51. 140 open1,8,2,+n$+",s,r"
  52. 145 i=1
  53. 150 input#1,a$(i),b$(i),c(i),cc(i),d(i)
  54. 155 i=i+1
  55. 160 ifst=0goto150
  56. 165 close1:print"[147]";spc(14)"file loaded":goto210
  57. 170 printspc(17)"update"
  58. 175 open1,1,0,n$
  59. 180 i=1
  60. 185 input#1,a$(i),b$(i),c(i),cc(i),d(i)
  61. 190 i=i+1
  62. 195 ifst=0goto185
  63. 200 close1:print"[147]":printspc(14)"file loaded"
  64. 205 printspc(11)"press stop on tape[146]"
  65. 210 printspc(7)"update before printing out[146]"
  66. 215 printspc(8)"1=update investment"
  67. 220 printspc(8)"2=add an investment"
  68. 225 printspc(8)"3=delete an investment"
  69. 230 printspc(8)"4=file complete"
  70. 235 printspc(8)"5=error correction"
  71. 240 printspc(8)"6=stock sold"
  72. 245 printspc(8)"7=cap gain data"
  73. 246 printspc(8)"8=return to loadstar"
  74. 250 print"        choose 1-8: [157]";bk$;:nc=1:mo=2:gosub60500:z=val(a$)
  75. 255 onzgoto260,445,450,385,490,770,935,60000
  76. 257 print"[145]";:goto250
  77. 260 forx=1toi-1
  78. 265 e(x)=((c(x)*.1)+c(x))/d(x)
  79. 270 e1=int(e(x)*100)/100
  80. 275 ife(x)>=e1+.005thene(x)=e1+.001
  81. 280 ife(x)<=e1+.005thene(x)=e1
  82. 285 f(x)=((c(x)*.2)+c(x))/d(x)
  83. 290 f1=int(f(x)*100)/100
  84. 295 iff(x)>=f1+.005thenf(x)=f1+.001
  85. 300 iff(x)<=f1+.005thenf(x)=f1
  86. 305 g(x)=((c(x)*.3)+c(x))/d(x)
  87. 310 g1=int(g(x)*100)/100
  88. 315 ifg(x)>=g1+.005theng(x)=g1+.001
  89. 320 ifg(x)<=g1+.005theng(x)=g1
  90. 325 h(x)=((c(x)*.4)+c(x))/d(x)
  91. 330 h1=int(h(x)*100)/100
  92. 335 ifh(x)>=h1+.005thenh(x)=h1+.001
  93. 340 ifh(x)<=h1+.005thenh(x)=h1
  94. 345 print"[147]";spc(5)"computing capital gain (loss)":printa$(x)
  95. 350 print"current price per share=";bk$;:mo=130:nc=9:gosub60500:cp(x)=val(a$)
  96. 355 cg(x)=(cp(x)*d(x))-c(x)
  97. 360 pg(x)=(cg(x)/c(x))*100:xt=pg(1)
  98. 362 pg(x)=int(pg(x)/.1):pg(x)=pg(x)*.1
  99. 365 tc=c(x)+tc
  100. 370 pr=cg(x)+pr
  101. 375 next
  102. 380 tg=(pr/tc)*100:tg=int(tg/.1):tg=tg*.1
  103. 385 print"[147]":printspc(8)"1=print hard copy":printspc(8)"2=save to tape"
  104. 390 printspc(8)"3=save to disk":printspc(8)"4=print to screen":
  105. 395 printspc(8)"5=rerun program":printspc(8)"6=error correction"
  106. 396 printspc(8)"7=return to loadstar"
  107. 397 print"        choose 1-7: [157]";bk$;:mo=2:nc=1:gosub60500:z=val(a$)
  108. 400 onzgoto590,405,675,710,765,490,60000
  109. 402 print"[145]";:goto396
  110. 405 printspc(9)"load data tape[146]"
  111. 410 print"file name=";bk$;:nc=16:mo=144:gosub60500:n$=a$
  112. 415 open1,1,2,n$
  113. 420 fory=1toi-1
  114. 425 print#1,a$(y);r$;b$(y);r$;c(y);r$;cc(y);r$;d(y)
  115. 430 nexty
  116. 435 printspc(13)"file complete"
  117. 440 close1:goto210
  118. 445 goto80
  119. 450 printspc(15)"[147]delete an investment"
  120. 455 forx=1toi-1:printspc(10)x;a$(x):next
  121. 460 print"number to delete:";bk$;:nc=3:mo=2:gosub60500:z=val(a$)
  122. 465 forx=ztoi
  123. 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)
  124. 475 next
  125. 480 print"more to delete? y/n":poke198,0:wait198,1:getz$:ifz$="y"orz$="[217]"then450
  126. 481 ifz$<>"n"anda$<>"[206]"thenprint"[145]";:goto480
  127. 485 goto915
  128. 490 printspc(12)"[147]error correction[146]"
  129. 495 forx=1toi-1:printx;a$(x):next
  130. 500 print"correct which? ->";bk$;:mo=2:nc=3:gosub60500:m%=val(a$)
  131. 505 printspc(8)"1[146] name"
  132. 510 printspc(8)"2[146] date bought"
  133. 515 printspc(8)"3[146] # shares"
  134. 520 printspc(8)"4[146] price"
  135. 525 printspc(8)"5[146] commission"
  136. 530 print"correcting ";a$(m%);
  137. 533 print"choose 1-5:";bk$;:nc=1:mo=2:gosub60500:c=val(a$)
  138. 535 oncgoto540,550,560,570,580
  139. 540 printa$(m%)"-change name to:";bk$;:nc=20:mo=146:gosub60500:a$(m%)=a$
  140. 545 goto385
  141. 550 printa$(m%):print"-change date mm/dd/yy ";b$(m%);" to:";bk$;
  142. 553 mo=130:nc=8:gosub60500:b$(m%)=a$
  143. 555 goto385
  144. 560 printa$(m%):print"-change # of shares ";d(m%);" to:";bk$;
  145. 563 mo=2:nc=8:gosub60500:d(m%)=val(a$)
  146. 565 goto385
  147. 570 printa$(m%):print"-change price $"p(m%);" to:";bk$;
  148. 573 mo=130:nc=9:gosub60500:p(m%)=val(a$)
  149. 575 c(m%)=(d(m%)*p(m%)):goto385
  150. 580 printa$(m%):print"-change commission cost $"cc(m%);" to:";bk$;
  151. 583 mo=130:nc=9:gosub60500:cc(m%)=val(a$)
  152. 585 goto385
  153. 590 print"[147]";spc(9)"printing a hard copy"
  154. 591 open15,4,15:close15:ifst=0then600
  155. 592 print"your printer isn't online."
  156. 593 print"[144]check it out and try again."
  157. 594 print"press [return] to continue."
  158. 595 geta$:ifa$<>chr$(13)then595
  159. 596 goto385
  160. 600 open4,4:cmd4:printtd$:print
  161. 605 fory=1toi-1
  162. 610 print#4,y;a$(y);" bought on ";b$(y);" @ $";(c(y)/d(y));
  163. 612 print#4,"/share";"  #shares=";d(y)
  164. 615 print#4,"current price= $";cp(y):print#4,"commission cost= $";cc(y)
  165. 620 print#4,"10% profit @ $";e(y):print#4,"20% profit @ $";f(y)
  166. 625 print#4,"30%[160]profit @ $";g(y):print#4,"40% profit @ $";h(y)
  167. 630 print#4,"current capital gain= $";cg(y)
  168. 635 print#4,"amount invested     = $";c(y)
  169. 640 print#4,"current value       = $";(c(y)+cg(y))
  170. 645 print#4,"current percent gain=";pg(y);"%"
  171. 650 print#4:next
  172. 655 print#4:print#4,"total amount invested =$";tc
  173. 660 print#4,"total capital gain    =$";pr
  174. 665 print#4,"total percent gain    ="tg;"%":print
  175. 670 print#4,chr$(12):print#4:close4:print"[147]":goto210
  176. 675 print"[147]";spc(5)"writing investment data to disk[146]"
  177. 680 print"file name=";bk$;:mo=146:nc=16:gosub60500:n$=a$
  178. 685 open1,8,2,"@0:"+n$+",s,w"
  179. 690 fory=1toi-1
  180. 695 print#1,a$(y);r$;b$(y);r$;c(y);r$;cc(y);r$;d(y)
  181. 700 next
  182. 705 close1:print"[147]":goto210
  183. 710 print"[147]have you updated?  y/n":poke198,0:wait198,1
  184. 712 getz$:ifz$="n"then260
  185. 715 print"[147]";spc(8)"copy in your record book[146]"
  186. 720 fory=1toi-1
  187. 722 ifa$(y)="0 "then755
  188. 725 print"";y;a$(y):print"bought on ";b$(y);" @ $";(c(y)/d(y));"/share"
  189. 730 print"  #shares=";d(y):print"price= $";cp(y)
  190. 732 print"commission cost= $";cc(y)
  191. 735 print"10% profit @ $";e(y):print"20% profit @ $";f(y)
  192. 740 print"30% profit @ $";g(y):print"40% profit @ $";h(y)
  193. 745 print"press return to continue"
  194. 750 geta$:ifa$<>chr$(13)then750
  195. 755 next
  196. 760 print"[147]":goto210
  197. 765 run
  198. 770 print"[147]have you created a capital gain file for this year?  y/n"
  199. 775 poke198,0:wait198,1:getz$:ifz$="y"orz$="[217]"then935
  200. 778 ifz$<>"n"anda$<>"[206]"then775
  201. 780 forx=1toi-1:printx,left$(a$(x),8),:next:printchr$(13)
  202. 785 print"which investment has been sold:";bk$;
  203. 787 mo=2:nc=3:gosub60500:z=val(a$)
  204. 790 n=n+1
  205. 795 ag$(n)=a$(z):bg$(n)=b$(z):cd(n)=c(z):dg(n)=d(z)
  206. 797 ca(n)=cg(z):gg(n)=cc(z)
  207. 800 print"sold @:$";bk$;:mo=130:nc=9:gosub60500:sa(n)=val(a$)
  208. 805 gc(n)=(sa(n)*dg(n))-cd(n):ag=ag+gc(n)
  209. 810 print"date sold mm/dd/yy:";bk$;:mo=130:nc=8:gosub60500:sd$(n)=a$
  210. 815 printspc(7)"capital gain data for year"
  211. 820 print"file name=";bk$;:mo=146:nc=16:gosub60500:n$=a$
  212. 825 printspc(10)"[147]save to t[146]ape or d[146]isk"
  213. 830 poke198,0:wait198,1:getz$:ifz$="d"o