home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
MISC
/
FINANCE
/
INVEST.LBR
/
CBUDGET.BZS
/
CBUDGET.BAS
Wrap
BASIC Source File
|
2000-06-30
|
11KB
|
255 lines
10 REM ************ RECURSIVE BUDGETING *****************
20 REM
30 REM by O.E. Dial
40 REM
50 REM Ref. 'PERSONAL COMPUTING' May/June 1977
60 REM pgs. 54-59
70 REM
80 REM --------------------------------------------------
90 REM
100 Q=27: V$="###.#" : W$="$$#####," : U$="###"
120 DIM D(18),E$(Q),V(Q),F(Q)
130 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT
140 PRINT TAB(19)"RECURSIVE BUDGETING MODEL": PRINT: PRINT TAB(28)"* * *"
150 REM
160 DATA SALARY/WAGES,OTHER INCOME,FED INC TAX,STATE AND LOCAL TAX
170 DATA SOCIAL SECURITY,UNEMPLOYMENT INS,HEALTH INS
180 DATA LIFE INS,CONTRIBUTIONS,OTHER DEDUCTIONS
190 DATA RENT/MORTGAGE,LIFE INS, HEALTH INS, HOUSE INS
200 DATA AUTO INS,CAR PAYMENTS,LOAN PAYMENTS,TRASH REMOVAL
210 DATA OTHER FIXED EXP
220 DATA FOOD/BEVERAGES,CLOTHING,DRY CLEANING,BARBER/BEAUTY
230 DATA HOME MAINT,HOME HEAT'G FUEL,WATER,ELECTRICITY,TELEPHONE
240 DATA GAS/OIL,AUTO MAINT,FARES/TOLLS/PARKING, DENTIST
250 DATA PHYSICIAN,DRUGS/SUNDRIES,SCHOOL EXPENSE,FAMILY ALLOWANCE
260 DATA CLUBS/LODGES,THEATER/SPORTS,RESTAURANTS
270 DATA OTHER ENT'MENT,MAG'S/BOOKS/PAPERS,SITTERS,CHILD CARE
280 DATA VACATION SAVINGS,OTHER SAVINGS,CONTRIBUTIONS,OTHER EXPENSES
290 REM
300 REM
310 PRINT: PRINT"Select your budgeting period by number. Later on it will"
320 PRINT"be extended to one year.": PRINT
330 PRINT TAB(10)"1-WEEKLY"
340 PRINT TAB(10)"2-BIWEEKLY"
350 PRINT TAB(10)"3-SEMIMONTHLY"
360 PRINT TAB(10)"4-MONTHLY"
370 PRINT
380 INPUT": ",P
390 IF P>4 THEN PRINT"Try again!" ELSE 410
400 GOTO 310
410 IF P=1 THEN P=52
420 IF P=2 THEN P=26
430 IF P=3 THEN P=24
440 IF P=4 THEN P=12
450 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT
460 PRINT:PRINT"Alright, first let's look at income for the period."
470 PRINT
480 READ A$:PRINT A$;" $";: INPUT"",D(0):READ A$:PRINT A$;" $";:INPUT"",D(1)
490 TI=D(0)+D(1)
500 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT
510 PRINT:PRINT"Ok, now let's look at paycheck deductions.":PRINT
520 FOR J=2 TO 9: READ A$: PRINT A$;" $";:INPUT"",D(J):TD=TD+D(J): NEXT J
530 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT
540 PRINT"Ok, now let's look at fixed expenses.": PRINT
550 FOR J=10 TO 18:READ A$:PRINT A$;" $";:INPUT"",D(J):TF=TF+D(J): NEXT J
560 DF=TD+TF: SI=TI-DF: S=64
570 PRINT CHR$(26)
580 PRINT"Ok, at this point our table looks like this: ": PRINT
590 PRINT
600 GOSUB 2110: PRINT: PRINT TAB(19);
610 PRINT"RECURSIVE BUDGETING MODEL": PRINT: PRINT TAB(27)"* * *": PRINT
620 GOSUB 2110
630 PRINT:PRINT TAB(20)"SPENDABLE INCOME SUMMARY": PRINT
640 GOSUB 2100: PRINT TAB(3)"ACCOUNT"TAB(42)"PERIOD"TAB(57)"ANNUAL"
650 GOSUB 2100: PRINT"TOTAL INCOME"TAB(40);
660 PRINT USING W$;TI;:PRINT TAB(55);
670 PRINT USING W$;TI*P: PRINT:PRINT TAB(3)"PAYCHECK DEDUCTIONS"TAB(25);
680 PRINT USING W$;TD*(-1): PRINT
690 PRINT TAB(3)"FIXED EXPENSES"TAB(25);: PRINT USING W$;TF*(-1);
700 PRINT TAB(40);: PRINT USING W$;DF*(-1);: PRINT TAB(55);
710 PRINT USING W$;DF*(-1)*P
720 PRINT TAB(41)"-------"TAB(55)"--------":PRINT"SPENDABLE INCOME";
730 PRINT TAB(40);:PRINT USING W$;SI;:PRINT TAB(55);:PRINT USING W$;SI*P
740 PRINT TAB(41)"========"TAB(55)"========":PRINT:
750 GOSUB 2110: PRINT: PRINT
760 GOSUB 2120
770 RO=0
780 PRINT:PRINT"Ok, now for the first round of variable expense. Don't"
790 PRINT"pinch yourself in your estimates (within reason). Let the"
800 PRINT"computer help you to refine your budget later on.": PRINT
810 FOR J=0 TO Q:READ E$(J):PRINT E$(J);" $";: INPUT"",V(J):VT=VT+V(J):NEXT J
820 RESTORE
830 PRINT:PRINT
840 PRINT"Your budget for the first round totalled $"VT". This"
850 PRINT"compares to spendable income of $"SI". We have"
860 PRINT"prorated the difference, $"SI-VT", over all variable expense"
870 PRINT"accounts.": PRINT
880 GOSUB 2120: FOR J=0 TO Q:V(J)=INT(V(J)/VT*SI): NEXT J: VT=SI: PRINT
890 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT
900 PRINT"Now we begin the budget refinement phase. Make as many"
910 PRINT"passes as you like. As you review each account, decide"
920 PRINT"whether to FREEZE it or leave it for another pass.": PRINT
930 PRINT"HINT: Don't be in a hurry to freeze an account.": PRINT
940 PRINT"Your task is finished when all accounts are frozen!": PRINT
950 GOSUB 2120
960 FOR J=0 TO Q: IF V(J)=0 THEN 1180
970 PRINT
980 PRINT E$(J);" $";V(J): INPUT"Change ('Y' or 'N') ",A$
990 A$=LEFT$(A$,1)
1000 IF A$="N" THEN 1030 ELSE IF A$="Y" THEN 1010 ELSE 980
1010 INPUT"Revised amount $";A: IF A<V(J) THEN 1030
1020 GOSUB 2150
1030 INPUT"Freeze ('Y' or 'N') ",B$
1040 B$=LEFT$(B$,1)
1050 IF A$="Y" AND B$="Y" THEN 1100
1060 IF A$="Y" AND B$="N" THEN 1140
1070 IF A$="N" AND B$="N" THEN 1180
1080 VT=VT-V(J): FT=FT+V(J): SWAP F(J),V(J): V(J)=0: PRINT
1090 PRINT"Ok, the account has been frozen at $"F(J)".": GOTO 1180
1100 VT=VT-A: FT=FT+A: SWAP A,F(J): V(J)=0
1110 FOR K=0 TO Q: V(K)=INT(V(K)*(SI-FT)/VT): NEXT K: VT=SI-FT
1120 PRINT"Ok, the account has been frozen at $"F(J)", and the difference"
1130 PRINT"prorated over the remaining accounts.": PRINT: GOTO 1180
1140 VT=VT-V(J)+A: V(J)=A
1150 FOR K=0 TO Q:V(K)=INT(V(K)*(SI-FT)/VT): NEXT K: VT=SI-FT
1160 PRINT"Ok, the value has been changed to $"A", and the difference"
1170 PRINT"prorated over remaining accounts.": PRINT
1180 NEXT J: R=0: FOR J=0 TO Q: IF V(J)=0 THEN R=R+1: NEXT J
1190 IF R<=Q THEN 1210
1200 FOR J=0 TO Q: F(J)=INT(F(J)/FT*SI): NEXT J: VT=0: FT=SI: GOTO 1580
1210 PRINT"Now, let's recap variable expenses before going on to the"
1220 PRINT"next round.": PRINT: RO=RO+1: V1=0: F1=0
1230 FOR J=0 TO Q: V(J)=INT(V(J)/VT*(SI-FT)): NEXT J: VT=SI-FT
1240 GOSUB 2120
1250 PRINT TAB(7)"INTERIM SUMMARY OF VARIABLE EXPENSES";
1260 PRINT": NO."RO
1270 GOSUB 2100: PRINT TAB(3)"ACCOUNTS"TAB(28)"NUMBER"TAB(37)"PERCENT";
1280 PRINT TAB(48)"AMOUNT"TAB(56)"PERCENT"
1290 GOSUB 2100: FOR J=0 TO Q: IF V(J)+F(J)=0 THEN 1310
1300 IF V(J) THEN V1=V1+1 ELSE F1=F1+1
1310 NEXT J
1320 PRINT"VARIABLE EXPENSES"TAB(29);:PRINT USING U$;V1;:PRINT TAB(39);
1330 PRINT USING V$;V1/(V1+F1)*100;:PRINT TAB(46);:PRINT USING W$;VT;
1340 PRINT TAB(58);:PRINT USING V$;VT/TI*100: PRINT
1350 PRINT"FROZEN EXPENSES"TAB(29);:PRINT USING U$;F1;:PRINT TAB(39);
1360 PRINT USING V$;F1/(V1+F1)*100;: PRINT TAB(46);
1370 PRINT USING W$;FT;: PRINT TAB(58);:PRINT USING V$;FT/TI*100
1380 PRINT TAB(28)"-------"TAB(48)"--------"
1390 PRINT TAB(3)"TOTALS"TAB(29);:PRINT USING U$;F1+V1;: PRINT TAB(46);
1400 PRINT USING W$;VT+FT:PRINT TAB(28)"======="TAB(48)"========":PRINT
1410 GOSUB 2110: PRINT: PRINT
1420 GOSUB 1430: GOTO 1470
1430 PRINT TAB(8)"INTERIM STATUS OF VARIABLE EXPENSES NO."RO
1440 GOSUB 2100:PRINT TAB(3)"ACCOUNT"TAB(30)"VARIABLE"TAB(43)"FROZEN";
1450 PRINT TAB(54)"PERCENT"
1460 GOSUB 2100: PRINT
1470 FOR J=0 TO Q: IF V(J)+F(J)=0 THEN 1530 ELSE PRINT E$(J);: R2=R2+1
1480 IF F(J) THEN 1500 ELSE PRINT TAB(29): PRINT USING W$;V(J);:PRINT TAB(55);
1490 PRINT USING V$;V(J)/TI*100: GOTO 1520
1500 PRINT TAB(40);: PRINT USING W$;F(J);: PRINT TAB(55);
1510 PRINT USING V$;F(J)/TI*100
1520 IF INT(R2/5)=R2/5 THEN PRINT
1530 NEXT J: PRINT: R2=0
1540 GOSUB 2110: PRINT
1550 PRINT: PRINT:
1560 PRINT"Now we make another pass through variable expenses.":PRINT
1570 GOTO 950
1580 PRINT:PRINT:PRINT"Please enter the requested information before we ";
1590 PRINT"provide a final detail of your budget.": PRINT
1600 PRINT TAB(18)"* DON'T use commas or colons *":PRINT
1610 INPUT"Name: ",A$: INPUT"Budget year: ",A
1620 B=LEN(A$): B=16-B/2
1630 PRINT: PRINT
1640 GOSUB 2130
1650 GOSUB 2110: PRINT
1660 PRINT
1670 PRINT TAB(B)"* THE "A$" FAMILY BUDGET FOR "A" *":PRINT
1680 GOSUB 2110: PRINT
1690 PRINT TAB(6)"ACCOUNT"TAB(20)"|"TAB(26)"INCOME"TAB(38)"|";
1700 PRINT TAB(44)"EXPENSE"TAB(56)"|PERCENT"
1710 PRINT TAB(20)"|-----------------|-----------------| TOTAL"
1720 PRINT TAB(20)"| PERIOD | ANNUAL | PERIOD | ANNUAL |INCOME"
1730 PRINT "-------------------|--------|--------|--------|--------|-------"
1740 X$="|$$#####,|$$#####,| | | ###.#"
1750 Y$="| | |$$#####,|$$#####,| ###.#"
1760 GOTO 1780
1770 PRINT"| | | | |": RETURN
1780 PRINT"INCOME"TAB(20);:PRINT USING X$;TI;TI*P;TI/TI*100
1790 PRINT"------"TAB(20);
1800 GOSUB 1770
1810 READ A$:PRINT A$TAB(20);:PRINT USING X$;D(0);D(0)*P;D(0)/TI*100
1820 READ A$:PRINT A$TAB(20);:PRINT USING X$;D(1);D(1)*P;D(1)/TI*100
1830 PRINT TAB(20);
1840 GOSUB 1770
1850 PRINT"PAYCHECK DEDUCT'S"TAB(20);
1860 PRINT USING Y$;TD;TD*P;TD/TI*100
1870 PRINT "-----------------"TAB(20);
1880 GOSUB 1770
1890 FOR J=2 TO 9: READ A$: IF D(J)=0 THEN 1910 ELSE PRINT A$TAB(20);
1900 PRINT USING Y$;D(J);D(J)*P;D(J)/TI*100
1910 NEXT J: PRINT TAB(20);
1920 GOSUB 1770
1930 PRINT"FIXED EXPENSES"TAB(20);
1940 PRINT USING Y$;TF;TF*P;TF/TI*100
1950 PRINT "--------------"TAB(20);
1960 GOSUB 1770
1970 FOR J=10 TO 18: READ A$: IF D(J)=0 THEN 1990 ELSE PRINT A$TAB(20);
1980 PRINT USING Y$;D(J);D(J)*P;D(J)/TI*100
1990 NEXT J: PRINT TAB(20);
2000 GOSUB 1770
2010 PRINT"VARIABLE EXPENSE"TAB(20);
2020 PRINT USING Y$;FT;FT*P;FT/TI*100
2030 PRINT "----------------"TAB(20);
2040 GOSUB 1770
2050 FOR J=0 TO Q: IF F(J)=0 THEN 2070 ELSE PRINT E$(J)TAB(20);
2060 PRINT USING Y$;F(J);F(J)*P;F(J)/TI*100
2070 NEXT J: PRINT
2080 GOSUB 2110: PRINT
2090 GOSUB 2110: PRINT: GOTO 2200
2100 FOR L=1 TO S:PRINT"-";:NEXT L: PRINT: RETURN
2110 FOR L=1 TO S:PRINT"=";:NEXT L: PRINT: RETURN
2120 PRINT"PRESS 'RETURN' TO CONTINUE":INPUT"",A$
2130 PRINT CHR$(26):PRINT:PRINT:PRINT:PRINT
2140 RETURN
2150 IF A<=V(J) THEN 2190
2160 IF A<=VT THEN 2190
2170 PRINT"* You have exceeded your balance of spendable income by $"A-SI;
2180 PRINT" *": INPUT"Revised amount $",A: PRINT
2190 RETURN
2200 RESTORE: READ A$:READ A$:PRINT: S=79
2210 PRINT TAB(21)"* EXPENSE BAR CHART *"
2220 PRINT TAB(20)"PERCENT OF TOTAL INCOME":PRINT
2230 GOSUB 2100: PRINT
2240 GOSUB 2380: PRINT
2250 FOR J=2 TO 18: READ A$:IF D(J)=0 THEN 2280
2260 A=INT((D(J)/TI*100)+.5): PRINT A$;
2270 GOSUB 2420
2280 NEXT J
2290 FOR J=0 TO Q
2300 IF F(J)=0 THEN 2330
2310 A=INT((F(J)/TI*100)+.5): PRINT E$(J);
2320 GOSUB 2420
2330 NEXT J: PRINT
2340 GOSUB 2380: PRINT: PRINT
2350 GOSUB 2110:PRINT:PRINT: GOTO 2490
2360 REM
2370 GOTO 2490
2380 REM
2390 PRINT TAB(20)" ....|....1....|....2....|....3....|....4....|....5";
2400 PRINT"....|....6"
2410 RETURN
2420 IF A<1 THEN PRINT TAB(21)"]": GOTO 2450
2430 IF A>60 THEN A=60
2440 PRINT TAB(21);:FOR K=1 TO A: PRINT"]";:NEXT K: PRINT
2450 RETURN
2460 REM
2470 GOTO 2490
2480 REM
2490 PRINT: PRINT:
2500 END
TAB(21);:FOR K=1 TO A: PRINT"]";:NEXT K: PRINT
2450 RETURN
2460 REM
2470 GOTO 2490
2480 REM
2490 PRI