ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

260 lines
10 KiB

  1. 10 REM ************ RECURSIVE BUDGETING *****************
  2. 20 REM
  3. 30 REM by O.E. Dial
  4. 40 REM
  5. 50 REM Ref. 'PERSONAL COMPUTING' May/June 1977
  6. 60 REM pgs. 54-59
  7. 70 REM
  8. 80 REM --------------------------------------------------
  9. 90 REM
  10. 100 Q=27: V$="###.#" : W$="$$#####," : U$="###"
  11. 110 CL$=CHR$(27)+CHR$(69):REM Screen clear
  12. 120 DIM D(18),E$(Q),V(Q),F(Q)
  13. 130 PRINT CL$;
  14. 140 PRINT TAB(19);"RECURSIVE BUDGETING MODEL": PRINT: PRINT TAB(28);"* * *"
  15. 150 PRINT CL$;
  16. 160 DATA SALARY/WAGES,OTHER INCOME,FED INC TAX,STATE AND LOCAL TAX
  17. 170 DATA SOCIAL SECURITY,UNEMPLOYMENT INS,HEALTH INS
  18. 180 DATA LIFE INS,CONTRIBUTIONS,OTHER DEDUCTIONS
  19. 190 DATA RENT/MORTGAGE,LIFE INS, HEALTH INS, HOUSE INS
  20. 200 DATA AUTO INS,CAR PAYMENTS,LOAN PAYMENTS,TRASH REMOVAL
  21. 210 DATA OTHER FIXED EXP
  22. 220 DATA FOOD/BEVERAGES,CLOTHING,DRY CLEANING,BARBER/BEAUTY
  23. 230 DATA HOME MAINT,"HOME HEAT'G FUEL",WATER,ELECTRICITY,TELEPHONE
  24. 240 DATA GAS/OIL,AUTO MAINT,FARES/TOLLS/PARKING,DENTIST
  25. 250 DATA PHYSICIAN,DRUGS/SUNDRIES,SCHOOL EXPENSE,FAMILY ALLOWANCE
  26. 260 DATA CLUBS/LODGES,THEATER/SPORTS,RESTAURANTS
  27. 270 DATA "OTHER ENT'MENT","MAG'S/BOOKS/PAPERS",SITTERS,CHILD CARE
  28. 280 DATA VACATION SAVINGS,OTHER SAVINGS,CONTRIBUTIONS,OTHER EXPENSES
  29. 290 REM
  30. 300 REM
  31. 310 PRINT: PRINT"Select your budgeting period by number. Later on it will"
  32. 320 PRINT"be extended to one year.": PRINT
  33. 330 PRINT TAB(10);"1-WEEKLY"
  34. 340 PRINT TAB(10);"2-BIWEEKLY"
  35. 350 PRINT TAB(10);"3-SEMIMONTHLY"
  36. 360 PRINT TAB(10);"4-MONTHLY"
  37. 370 PRINT
  38. 380 INPUT": ",P
  39. 390 IF P>4 THEN PRINT"Try again!" ELSE 410
  40. 400 GOTO 310
  41. 410 IF P=1 THEN P=52
  42. 420 IF P=2 THEN P=26
  43. 430 IF P=3 THEN P=24
  44. 440 IF P=4 THEN P=12
  45. 450 PRINT CL$;
  46. 460 PRINT:PRINT"Alright, first let's look at income for the period."
  47. 470 PRINT
  48. 480 READ A$:PRINT A$;" $";: INPUT"",D(0):READ A$:PRINT A$;" $";:INPUT"",D(1)
  49. 490 TI=D(0)+D(1)
  50. 500 PRINT CL$;
  51. 510 PRINT:PRINT"Ok, now let's look at paycheck deductions.":PRINT
  52. 520 FOR J=2 TO 9: READ A$: PRINT A$;" $";:INPUT"",D(J):TD=TD+D(J): NEXT J
  53. 530 PRINT CL$;
  54. 540 PRINT"Ok, now let's look at fixed expenses.": PRINT
  55. 550 FOR J=10 TO 18:READ A$:PRINT A$;" $";:INPUT"",D(J):TF=TF+D(J): NEXT J
  56. 560 DF=TD+TF: SI=TI-DF: S=64
  57. 570 PRINT CL$;
  58. 580 PRINT"Ok, at this point our table looks like this: ": PRINT
  59. 590 PRINT
  60. 600 GOSUB 2110: PRINT: PRINT TAB(19);
  61. 610 PRINT"RECURSIVE BUDGETING MODEL": PRINT: PRINT TAB(27);"* * *": PRINT
  62. 620 GOSUB 2110
  63. 630 PRINT:PRINT TAB(20);"SPENDABLE INCOME SUMMARY": PRINT
  64. 640 GOSUB 2100: PRINT TAB(3);"ACCOUNT";TAB(42);"PERIOD";TAB(57);"ANNUAL"
  65. 650 GOSUB 2100: PRINT"TOTAL INCOME";TAB(40);
  66. 660 PRINT USING W$;TI;:PRINT TAB(55);
  67. 670 PRINT USING W$;TI*P: PRINT:PRINT TAB(3);"PAYCHECK DEDUCTIONS";TAB(25);
  68. 680 PRINT USING W$;TD*(-1): PRINT
  69. 690 PRINT TAB(3);"FIXED EXPENSES";TAB(25);: PRINT USING W$;TF*(-1);
  70. 700 PRINT TAB(40);: PRINT USING W$;DF*(-1);: PRINT TAB(55);
  71. 710 PRINT USING W$;DF*(-1)*P
  72. 720 PRINT TAB(41);"-------";TAB(55);"--------":PRINT"SPENDABLE INCOME";
  73. 730 PRINT TAB(40);:PRINT USING W$;SI;:PRINT TAB(55);:PRINT USING W$;SI*P
  74. 740 PRINT TAB(41);"========";TAB(55);"========":PRINT:
  75. 750 GOSUB 2110: PRINT: PRINT
  76. 760 GOSUB 2120
  77. 770 RO=0
  78. 780 PRINT:PRINT"Ok, now for the first round of variable expense. Don't"
  79. 790 PRINT"pinch yourself in your estimates (within reason). Let the"
  80. 800 PRINT"computer help you to refine your budget later on.": PRINT
  81. 810 FOR J=0 TO Q:READ E$(J):PRINT E$(J);" $";: INPUT"",V(J):VT=VT+V(J):NEXT J
  82. 820 RESTORE
  83. 830 PRINT:PRINT
  84. 840 PRINT"Your budget for the first round totalled $";VT;". This"
  85. 850 PRINT"compares to spendable income of $";SI;". We have"
  86. 860 PRINT"prorated the difference, $";SI-VT;", over all variable expense"
  87. 870 PRINT"accounts.": PRINT
  88. 880 GOSUB 2120: FOR J=0 TO Q:V(J)=INT(V(J)/VT*SI): NEXT J: VT=SI: PRINT
  89. 890 PRINT CL$;
  90. 900 PRINT"Now we begin the budget refinement phase. Make as many"
  91. 910 PRINT"passes as you like. As you review each account, decide"
  92. 920 PRINT"whether to FREEZE it or leave it for another pass.": PRINT
  93. 930 PRINT"HINT: Don't be in a hurry to freeze an account.": PRINT
  94. 940 PRINT"Your task is finished when all accounts are frozen!": PRINT
  95. 950 GOSUB 2120
  96. 960 FOR J=0 TO Q: IF V(J)=0 THEN 1180
  97. 970 PRINT
  98. 980 PRINT E$(J);" $";V(J): INPUT"Change ('Y' or 'N') ",A$
  99. 990 A$=LEFT$(A$,1)
  100. 1000 IF A$="N" THEN 1030 ELSE IF A$="Y" THEN 1010 ELSE 980
  101. 1010 INPUT"Revised amount $";A: IF A<V(J) THEN 1030
  102. 1020 GOSUB 2150
  103. 1030 INPUT"Freeze ('Y' or 'N') ",B$
  104. 1040 B$=LEFT$(B$,1)
  105. 1050 IF A$="Y" AND B$="Y" THEN 1100
  106. 1060 IF A$="Y" AND B$="N" THEN 1140
  107. 1070 IF A$="N" AND B$="N" THEN 1180
  108. 1080 VT=VT-V(J): FT=FT+V(J): U=F(J):F(J)=V(J):V(J)=U: V(J)=0: PRINT
  109. 1090 PRINT"Ok, the account has been frozen at $";F(J);".": GOTO 1180
  110. 1100 VT=VT-A: FT=FT+A: U=A:A=F(J):F(J)=U: V(J)=0
  111. 1110 FOR K=0 TO Q: V(K)=INT(V(K)*(SI-FT)/VT): NEXT K: VT=SI-FT
  112. 1120 PRINT"Ok, the account has been frozen at $";F(J);", and the difference"
  113. 1130 PRINT"prorated over the remaining accounts.": PRINT: GOTO 1180
  114. 1140 VT=VT-V(J)+A: V(J)=A
  115. 1150 FOR K=0 TO Q:V(K)=INT(V(K)*(SI-FT)/VT): NEXT K: VT=SI-FT
  116. 1160 PRINT"Ok, the value has been changed to $";A;", and the difference"
  117. 1170 PRINT"prorated over remaining accounts.": PRINT
  118. 1180 NEXT J: R=0: FOR J=0 TO Q: IF V(J)=0 THEN R=R+1
  119. 1185 NEXT J
  120. 1190 IF R<=Q THEN 1210
  121. 1200 FOR J=0 TO Q: F(J)=INT(F(J)/FT*SI): NEXT J: VT=0: FT=SI: GOTO 1580
  122. 1210 PRINT"Now, let's recap variable expenses before going on to the"
  123. 1220 PRINT"next round.": PRINT: RO=RO+1: V1=0: F1=0
  124. 1230 FOR J=0 TO Q: V(J)=INT(V(J)/VT*(SI-FT)): NEXT J: VT=SI-FT
  125. 1240 GOSUB 2120
  126. 1250 PRINT TAB(7);"INTERIM SUMMARY OF VARIABLE EXPENSES";
  127. 1260 PRINT": NO.";RO
  128. 1270 GOSUB 2100: PRINT TAB(3);"ACCOUNTS";TAB(28);"NUMBER";TAB(37);"PERCENT";
  129. 1280 PRINT TAB(48);"AMOUNT";TAB(56);"PERCENT"
  130. 1290 GOSUB 2100: FOR J=0 TO Q: IF V(J)+F(J)=0 THEN 1310
  131. 1300 IF V(J) THEN V1=V1+1 ELSE F1=F1+1
  132. 1310 NEXT J
  133. 1320 PRINT"VARIABLE EXPENSES";TAB(29);:PRINT USING U$;V1;:PRINT TAB(39);
  134. 1330 PRINT USING V$;V1/(V1+F1)*100;:PRINT TAB(46);:PRINT USING W$;VT;
  135. 1340 PRINT TAB(58);:PRINT USING V$;VT/TI*100: PRINT
  136. 1350 PRINT"FROZEN EXPENSES";TAB(29);:PRINT USING U$;F1;:PRINT TAB(39);
  137. 1360 PRINT USING V$;F1/(V1+F1)*100;: PRINT TAB(46);
  138. 1370 PRINT USING W$;FT;: PRINT TAB(58);:PRINT USING V$;FT/TI*100
  139. 1380 PRINT TAB(28);"-------";TAB(48);"--------"
  140. 1390 PRINT TAB(3);"TOTALS";TAB(29);:PRINT USING U$;F1+V1;: PRINT TAB(46);
  141. 1400 PRINT USING W$;VT+FT:PRINT TAB(28);"=======";TAB(48);"========":PRINT
  142. 1410 GOSUB 2110: PRINT: PRINT
  143. 1420 GOSUB 1430: GOTO 1470
  144. 1430 PRINT TAB(8);"INTERIM STATUS OF VARIABLE EXPENSES NO.";RO
  145. 1440 GOSUB 2100:PRINT TAB(3);"ACCOUNT";TAB(30);"VARIABLE";TAB(43);"FROZEN";
  146. 1450 PRINT TAB(54);"PERCENT"
  147. 1460 GOSUB 2100: PRINT
  148. 1470 FOR J=0 TO Q: IF V(J)+F(J)=0 THEN 1530 ELSE PRINT E$(J);: R2=R2+1
  149. 1480 IF F(J) THEN 1500 ELSE PRINT TAB(29): PRINT USING W$;V(J);:PRINT TAB(55);
  150. 1490 PRINT USING V$;V(J)/TI*100: GOTO 1520
  151. 1500 PRINT TAB(40);: PRINT USING W$;F(J);: PRINT TAB(55);
  152. 1510 PRINT USING V$;F(J)/TI*100
  153. 1520 IF INT(R2/5)=R2/5 THEN PRINT
  154. 1530 NEXT J: PRINT: R2=0
  155. 1540 GOSUB 2110: PRINT
  156. 1550 PRINT: PRINT:
  157. 1560 PRINT"Now we make another pass through variable expenses.":PRINT
  158. 1570 GOTO 950
  159. 1580 PRINT:PRINT:PRINT"Please enter the requested information before we ";
  160. 1590 PRINT"provide a final detail of your budget.": PRINT
  161. 1600 PRINT TAB(18);"* DON'T use commas or colons *":PRINT
  162. 1610 INPUT"Name: ",A$: INPUT"Budget year: ",A
  163. 1620 B=LEN(A$): B=16-B/2
  164. 1630 PRINT: PRINT
  165. 1640 GOSUB 2130
  166. 1650 GOSUB 2110: PRINT
  167. 1660 PRINT
  168. 1670 PRINT TAB(B);"* THE ";A$;" FAMILY BUDGET FOR ";A;" *":PRINT
  169. 1680 GOSUB 2110: PRINT
  170. 1690 PRINT TAB(6);"ACCOUNT";TAB(20);"|";TAB(26);"INCOME";TAB(38);"|";
  171. 1700 PRINT TAB(44);"EXPENSE";TAB(56);"|PERCENT"
  172. 1710 PRINT TAB(20); "|-----------------|-----------------| TOTAL"
  173. 1720 PRINT TAB(20); "| PERIOD | ANNUAL | PERIOD | ANNUAL |INCOME"
  174. 1730 PRINT "-------------------|--------|--------|--------|--------|-------"
  175. 1740 X$= "|$$#####,|$$#####,| | | ###.#"
  176. 1750 Y$= "| | |$$#####,|$$#####,| ###.#"
  177. 1760 GOTO 1780
  178. 1770 PRINT "| | | | |": RETURN
  179. 1780 PRINT"INCOME";TAB(20);:PRINT USING X$;TI;TI*P;TI/TI*100
  180. 1790 PRINT"------";TAB(20);
  181. 1800 GOSUB 1770
  182. 1810 READ A$:PRINT A$;TAB(20);:PRINT USING X$;D(0);D(0)*P;D(0)/TI*100
  183. 1820 READ A$:PRINT A$;TAB(20);:PRINT USING X$;D(1);D(1)*P;D(1)/TI*100
  184. 1830 PRINT TAB(20);
  185. 1840 GOSUB 1770
  186. 1850 PRINT"PAYCHECK DEDUCT'S";TAB(20);
  187. 1860 PRINT USING Y$;TD;TD*P;TD/TI*100
  188. 1870 PRINT "-----------------";TAB(20);
  189. 1880 GOSUB 1770
  190. 1890 FOR J=2 TO 9: READ A$: IF D(J)=0 THEN 1910 ELSE PRINT A$;TAB(20);
  191. 1900 PRINT USING Y$;D(J);D(J)*P;D(J)/TI*100
  192. 1910 NEXT J: PRINT TAB(20);
  193. 1920 GOSUB 1770
  194. 1930 PRINT"FIXED EXPENSES";TAB(20);
  195. 1940 PRINT USING Y$;TF;TF*P;TF/TI*100
  196. 1950 PRINT "--------------";TAB(20);
  197. 1960 GOSUB 1770
  198. 1970 FOR J=10 TO 18: READ A$: IF D(J)=0 THEN 1990 ELSE PRINT A$;TAB(20);
  199. 1980 PRINT USING Y$;D(J);D(J)*P;D(J)/TI*100
  200. 1990 NEXT J: PRINT TAB(20);
  201. 2000 GOSUB 1770
  202. 2010 PRINT"VARIABLE EXPENSE";TAB(20);
  203. 2020 PRINT USING Y$;FT;FT*P;FT/TI*100
  204. 2030 PRINT "----------------";TAB(20);
  205. 2040 GOSUB 1770
  206. 2050 FOR J=0 TO Q: IF F(J)=0 THEN 2070 ELSE PRINT E$(J);TAB(20);
  207. 2060 PRINT USING Y$;F(J);F(J)*P;F(J)/TI*100
  208. 2070 NEXT J: PRINT
  209. 2080 GOSUB 2110: PRINT
  210. 2090 GOSUB 2110: PRINT: GOTO 2200
  211. 2100 FOR L=1 TO S:PRINT"-";:NEXT L: PRINT: RETURN
  212. 2110 FOR L=1 TO S:PRINT"=";:NEXT L: PRINT: RETURN
  213. 2120 PRINT"PRESS 'RETURN' TO CONTINUE":INPUT"",A$
  214. 2130 PRINT CL$;
  215. 2140 RETURN
  216. 2150 IF A<=V(J) THEN 2190
  217. 2160 IF A<=VT THEN 2190
  218. 2170 PRINT"* You have exceeded your balance of spendable income by $";A-SI;
  219. 2180 PRINT" *": INPUT"Revised amount $",A: PRINT
  220. 2190 RETURN
  221. 2200 RESTORE: READ A$:READ A$:PRINT: S=79
  222. 2210 PRINT TAB(21);"* EXPENSE BAR CHART *"
  223. 2220 PRINT TAB(20);"PERCENT OF TOTAL INCOME":PRINT
  224. 2230 GOSUB 2100: PRINT
  225. 2240 GOSUB 2380: PRINT
  226. 2250 FOR J=2 TO 18: READ A$:IF D(J)=0 THEN 2280
  227. 2260 A=INT((D(J)/TI*100)+.5): PRINT A$;
  228. 2270 GOSUB 2420
  229. 2280 NEXT J
  230. 2290 FOR J=0 TO Q
  231. 2300 IF F(J)=0 THEN 2330
  232. 2310 A=INT((F(J)/TI*100)+.5): PRINT E$(J);
  233. 2320 GOSUB 2420
  234. 2330 NEXT J: PRINT
  235. 2340 GOSUB 2380: PRINT: PRINT
  236. 2350 GOSUB 2110:PRINT:PRINT: GOTO 2490
  237. 2360 REM
  238. 2370 GOTO 2490
  239. 2380 REM
  240. 2390 PRINT TAB(20);" ....|....1....|....2....|....3....|....4....|....5";
  241. 2400 PRINT"....|....6"
  242. 2410 RETURN
  243. 2420 IF A<1 THEN PRINT TAB(21);"]": GOTO 2450
  244. 2430 IF A>60 THEN A=60
  245. 2440 PRINT TAB(21);:FOR K=1 TO A: PRINT"]";:NEXT K: PRINT
  246. 2450 RETURN
  247. 2460 REM
  248. 2470 GOTO 2490
  249. 2480 REM
  250. 2490 PRINT: PRINT:
  251. 2500 END
  252. 3000 REM -------
  253. REM
  254. REM 1080 SWAP F(J),V(J) -> U=F(J):F(J)=V(J):V(J)=U
  255. REM 1100 SWAP A,F(J) -> U=A:A=F(J):F(J)=U
  256. REM Added semicolons as PRINT seperators
  257. REM Quoted text containing apostophes in DATA statements
  258. REM 1180 IF V(J)=0 THEN R=R+1: NEXT J -> NEXT J moved to 1185
  259. END