110 REM ALL REM STATEMENTS CAN BE CHANGED TO ALLOW USE OF TWO TERMINALS
120 REM SEE ARTICLE IN PERSONAL COMPUTING MAY/JUNE 77
130 Q=27:V$="###.#":W$="$$#####,":U$="###"
140 DIM D(18),E$(Q),V(Q),F(Q)
150 PRINT TAB(19)"RECURSIVE BUDGETING MODEL":PRINT:PRINT TAB(28)"* * *"
160 DATA SALARY/WAGES,OTHER INCOME,FED INC TAX,STATE & 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 SAVING,OTHER SAVINGS,CONTRIBUTIONS,OTHER EXPENSES
290 PRINT:PRINT"SELECT YOUR BUDGETING PERIOD BY NUMBER. LATER ON IT WILL"
300 PRINT"BE EXTENDED TO ONE YEAR.":PRINT
310 PRINT TAB(3)"1-WEEKLY"TAB(15)"2-BIWEEKLY"TAB(30)"3-SEMIMONTHLY";
320 PRINT TAB(45)"4-MONTHLY":PRINT
330 INPUT P:IF P>4 THEN PRINT"TRY AGAIN":GOTO 290
340 IF P=1 THEN P=52ELSE IF P=2 THEN P=26ELSE IF P=3 THEN P=24ELSE IF P=4 THEN P=12
350 PRINT:PRINT"ALRIGHT,FIRST LET'S LOOK AT INCOME FOR THE PERIOD.":PRINT
360 READ A$:PRINT A$;" $";:INPUT D(0):READ A$:PRINT A$;" $";:INPUT D(1)
370 TI=D(0)+D(1):PRINT
380 PRINT:PRINT"OK,NOW LET'S LOOK AT PAYCHECK DEDUCTIONS.":PRINT
390 FOR J=2 TO 9:READ A$:PRINT A$;:INPUT" $";D(J):TD=TD+D(J):NEXT J:PRINT 
400 PRINT"OK,NOW LET'S LOOK AT FIXED EXPENSES.":PRINT
410 FOR J=10 TO 18:READ A$:PRINT A$;:INPUT" $";D(J):TF=TF+D(J):NEXT J
420 DF=TD+TF:SI=TI-DF:S=64
430 PRINT:PRINT"OK,AT THIS TIME OUR TABLE LOOKS LIKE THIS:":PRINT
440 REM
450 GOSUB 1900:PRINT:PRINT TAB(19);
460 PRINT"RECURSIVE BUDGETING MODEL":PRINT:PRINT TAB(27)"* * *":PRINT
470 GOSUB 1900
480 PRINT:PRINT TAB(20)"SPENDABLE INCOME SUMMARY":PRINT
490 GOSUB 1890:PRINT TAB(3)"ACCOUNT"TAB(42)"PERIOD"TAB(57)"ANNUAL"
500 GOSUB 1890:PRINT"TOTAL INCOME" TAB(40);:PRINT USING W$;TI;:PRINT TAB(55)
510 PRINT USING W$;TI*P:PRINT:PRINT TAB(3)"PAYCHECK DEDUCTIONS"TAB(25);
520 PRINT USING W$;TD*(-1):PRINT
530 PRINT TAB(3)"FIXED EXPENSES"TAB(25);:PRINT USING W$;TF*(-1);
540 PRINT TAB(40);:PRINT USING W$;DF*(-1);:PRINT TAB(55);
550 PRINT USING W$;DF*(-1)*P
560 PRINT TAB(41)"-------"TAB(55)"--------":PRINT"SPENDABLE INCOME";
570 PRINT TAB(40);:PRINT USING W$;SI;:PRINT TAB(55);:PRINT USING W$;SI*P
580 PRINT TAB(41)"======="TAB(55)"========":PRINT:
590 GOSUB 1900:PRINT: PRINT
600 REM
610 GOSUB 1910:RO=0
620 PRINT:PRINT "OK,NOW FOR THE FIRST ROUND OF VARIABLE EXPENSE. DON'T"
630 PRINT"PINCH YOURSELF IN YOUR ESTIMATES (WITHIN REASON). LET THE"
640 PRINT"COMPUTER HELP YOU REFINE YOUR BUDGET LATER ON.":PRINT
650 FOR J=0 TO Q:READ E$(J) :PRINT E$(J);:INPUT" $";V(J):VT=VT+V(J):NEXT J
660 RESTORE:PRINT:PRINT
670 PRINT"YOUR BUDGET FOR THE FIRST ROUND TOTALLED $"VT". THIS"
680 PRINT"COMPARES TO SPENDABLE INCOME OF $"SI". WE HAVE"
690 PRINT"PRORATED THE DIFFERENCE, $"SI-VT",OVER ALL VARIABLE EXPENSE"
700 PRINT"ACCOUNTS.":PRINT
710 GOSUB 1910:FOR J=0 TO Q:V(J)=INT(V(J)/VT*SI):NEXT J:VT=SI:PRINT
720 PRINT"NOW WE BEGIN THE BUDGET REFINEMENT PHASE. MAKE AS MANY"
730 PRINT"PASSES AS YOU LIKE. AS YOU REVIEW EACH ACCOUNT,DECIDE"
740 PRINT"WHETHER TO FREEZE IT OR TO LEAVE IT FOR ANOTHER PASS.":PRINT
750 PRINT"HINT: DON'T BE IN A HURRY TO FREEZE AN ACCOUNT.":PRINT
760 PRINT"YOUR TASK IS FINISHED WHEN ALL ACCOUNTS ARE FROZEN.":PRINT
770 GOSUB 1910
780 FOR J=0 TO Q:PRINT:IF V(J)=0 THEN 980
790 PRINT E$(J);" $";V(J):INPUT"CHANGE ('Y' OR 'N')";A$
800 IF A$="N"THEN 840ELSE IF A$="Y"THEN 820ELSE IF A$<>"Y"THEN 790
810 GOTO 790
820 INPUT"REVISED AMOUNT $";A:IF A<V(J)THEN 840
830 GOSUB 1930
840 INPUT"FREEZE ('Y' OR 'N')";B$:PRINT
850 IF A$="Y"AND B$="Y"THEN 900
860 IF A$="Y"AND B$="N"THEN 940
870 IF A$="N"AND B$="N"THEN 980
880 VT=VT-V(J):FT=FT+V(J):SWAP F(J),V(J):V(J)=0:PRINT
890 PRINT"OK,THE ACCOUNT HAS BEEN FROZEN AT $"F(J)".":GOTO 980
900 VT=VT-A:FT=FT+A:SWAP A,F(J):V(J)=0
910 FOR K=O TO Q:V(K)=INT(V(K)*(SI-FT)/VT):NEXT K:VT=SI-FT
920 PRINT"OK,THE ACCOUNT HAS BEEN FROZEN AT $"F(J)",AND THE DIFFERENCE"
930 PRINT"PRORATED OVER REMAINING ACCOUNTS.":PRINT:GOTO 980
940 VT=VT-V(J)+A:V(J)=A
950 FOR K=0 TO Q:V(K)=INT(V(K)*(SI-FT)/VT):NEXT K:VT=SI-FT
960 PRINT"OK,THE VALUE HAS BEEN CHANGED TO $"A", AND THE DIFFERENCE"
970 PRINT"PRORATED OVER REMAINING ACCOUNTS.":PRINT
980 NEXT J:PRINT:R=0:FOR J=0 TO Q:IF V(J)=0 THEN R=R+1:NEXT J
990 IF R<=Q THEN 1010
1000 FOR J=O TO Q:F(J)=INT(F(J)/FT*SI):NEXT J:VT=0:FT=SI:GOTO 1380
1010 PRINT"NOW LET'S RECAP VARIABLE EXPENSES BEFORE GOING ON TO THE"
1020 PRINT"NEXT ROUND.":PRINT:RO=RO+1:V1=0:F1=0
1030 FOR J=0 TO Q:V(J)=INT(V(J)/VT*(SI-FT)):NEXT J:VT=SI-FT
1040 REM
1050 PRINT TAB(7)"INTERIM SUMMARY OF VARIABLE EXPENSES";
1060 PRINT":   NO."RO
1070 GOSUB 1890:PRINT TAB(3)"ACCOUNTS"TAB(28)"NUMBER"TAB(37)"PERCENT";
1080 PRINT TAB(48)"AMOUNT"TAB(56)"PERCENT"
1090 GOSUB 1890:FOR J=0 TO Q:IF V(J)+F(J)=0 THEN 1110
1100 IF V(J)THEN V1=V1+1ELSE F1=F1+1
1110 NEXT J
1120 PRINT"VARIABLE EXPENSES"TAB(29);:PRINT USING U$;V1;:PRINT TAB(39);
1130 PRINT USING V$;V1/(V1+F1)*100;:PRINT TAB(46);:PRINT USING W$;VT;
1140 PRINT TAB(58);:PRINT USING V$;VT/TI*100:PRINT
1150 PRINT"FROZEN EXPENSES"TAB(29);:PRINT USING U$;F1;:PRINT TAB(39);
1160 PRINT USING V$;F1/(V1+F1)*100;:PRINT TAB(46);
1170 PRINT USING W$;FT;:PRINT TAB(58);:PRINT USING V$;FT/TI*100
1180 PRINT TAB(28)"-------"TAB(48)"--------"
1190 PRINT TAB(3)"TOTALS"TAB(29);:PRINT USING U$;F1+V1;:PRINT TAB(46);
1200 PRINT USING W$;VT+FT:PRINT TAB(28)"======="TAB(48)"========":PRINT
1210 GOSUB 1900:PRINT:PRINT
1220 GOSUB 1230:GOTO 1270
1230 PRINT TAB(8)"INTERIM STATUS OF VARIABLE EXPENSES  NO."RO
1240 GOSUB 1890:PRINT TAB(3)"ACCOUNT"TAB(30)"VARIABLE"TAB(43)"FROZEN";
1250 PRINT TAB(54)"PERCENT"
1260 GOSUB 1890:PRINT
1270 FOR J=0 TO Q:IF V(J)+F(J)=0 THEN 1330ELSE PRINT E$(J);:R2=R2+1
1280 IF F(J)THEN 1300ELSE PRINT TAB(29):PRINT USING W$;V(J);:PRINT TAB(55);
1290 PRINT USING V$;V(J)/TI*100:GOTO 1320
1300 PRINT TAB(40);:PRINT USING W$;F(J);:PRINT TAB(55);
1310 PRINT USING V$;F(J)/TI*100
1320 IF INT(R2/5)=R2/5 THEN PRINT
1330 NEXT J:PRINT:R2=0
1340 GOSUB 1900:PRINT
1350 REM
1360 PRINT:PRINT "NOW WE MAKE ANOTHER PASS THROUGH VARIABLE EXPENSES.":PRINT
1370 GOTO 770
1380 PRINT"PLEASE INPUT THE REQUESTED INFORMATION BEFORE WE PROVIDE A"
1390 PRINT"FINAL DETAIL OF YOUR BUDGET.":PRINT
1400 PRINT TAB(18)"* USE NO COMMAS NOR COLONS *":PRINT
1410 INPUT"NAME";A$:INPUT"BUDGET YEAR";A
1420 B=LEN(A$):B=16-B/2
1430 REM
1440 GOSUB 1920
1450 GOSUB 1900:PRINT
1460 PRINT TAB(B)"* THE "A$" FAMILY BUDGET FOR"A"*":PRINT
1470 GOSUB 1900:PRINT
1480 PRINT TAB(6)"ACCOUNT"TAB(20)""TAB(26)"INCOME"TAB(38)":";
1490 PRINT TAB(44)"EXPENSE"TAB(56)":PERCENT"
1500 PRINT TAB(20)":-----------------:-----------------: TOTAL"
1510 PRINT TAB(20)": PERIOD : ANNUAL : PERIOD : ANNUAL : INCOME"
1520 PRINT"--------------------:--------:--------:--------:--------:------"
1530 X$=":$$#####,:$$#####,:        :        : ###.#"
1540 Y$=":        :        :$$#####,:$$#####,: ###.#"
1550 GOTO 1570
1560 PRINT":        :        :        :        :":RETURN
1570 PRINT"INCOME"TAB(20);:PRINT USING X$;TI;TI*P;TI/TI*100
1580 PRINT"------"TAB(20);
1590 GOSUB 1560
1600 READ A$:PRINT A$TAB(20);:PRINT USING X$;D(0);D(0)*P;D(0)/TI*100
1610 READ A$:PRINT A$TAB(20);:PRINT USING X$;D(1);D(1)*P;D(1)/TI*100
1620 PRINT TAB(20);
1630 GOSUB 1560
1640 PRINT"PAYCHECK DEDUCT'S"TAB(20);
1650 PRINT USING Y$;TD;TD*P;TD/TI*100
1660 PRINT"-----------------"TAB(20);
1670 GOSUB 1560
1680 FOR J=2 TO 9:READ A$:IF D(J)=0 THEN 1700ELSE PRINT A$TAB(20);
1690 PRINT USING Y$;D(J);D(J)*P;D(J)/TI*100
1700 NEXT J:PRINT TAB(20);
1710 GOSUB 1560
1720 PRINT"FIXED EXPENSES"TAB(20);
1730 PRINT USING Y$;TF;TF*P;TF/TI*100
1740 PRINT"--------------"TAB(20);
1750 GOSUB 1560
1760 FOR J=10 TO 18:READ A$:IF D(J)=0 THEN 1780ELSE PRINT A$TAB(20);
1770 PRINT USING Y$;D(J);D(J)*P;D(J)/TI*100
1780 NEXT J:PRINT TAB(20);
1790 GOSUB 1560
1800 PRINT"VARIABLE EXPENSE"TAB(20);
1810 PRINT USING Y$;FT;FT*P;FT/TI*100
1820 PRINT"----------------"TAB(20);
1830 GOSUB 1560
1840 FOR J=0 TO Q:IF F(J)=0 THEN 1860ELSE PRINT E$(J)TAB(20);
1850 PRINT USING Y$;F(J);F(J)*P;F(J)/TI*100
1860 NEXT J:PRINT
1870 GOSUB 1900:PRINT
1880 GOSUB 1900:PRINT:GOTO 1980
1890 FOR L=1 TO S:PRINT"-";:NEXT L:PRINT:RETURN
1900 FOR L=1 TO S:PRINT"=";:NEXT L:PRINT:RETURN
1910 PRINT"PRESS 'Y' TO CONTINUE":PRINT:INPUT A$:PRINT:RETURN
1920 FOR L=1 TO 10:PRINT;:NEXT L:RETURN
1930 IF A<=V(J)THEN 1970
1940 IF A<=VT THEN 1970
1950 PRINT"* YOU HAVE EXCEEDED YOUR BALANCE OF SPENDABLE INCOME BY $"A-SI;
1960 PRINT" *":INPUT"REVISED AMOUNT $";A:PRINT
1970 RETURN
1980 RESTORE:READ A$:READ A$:PRINT:PRINT:S=95
1990 PRINT TAB(21)"* EXPENSE BAR CHART *"
2000 PRINT TAB(20)"PERCENT OF TOTAL INCOME":PRINT
2010 GOSUB 1890:PRINT
2020 GOSUB 2140:PRINT
2030 FOR J=2 TO 18:READ A$:IF D(J)=0 THEN 2060
2040 A=INT(D(J)/TI*300):PRINT A$;
2050 GOSUB 2170
2060 NEXT J
2070 FOR J=0 TO Q:IF F(J)=0 THEN 2100
2080 A=INT(F(J)/TI*300):PRINT E$(J);
2090 GOSUB 2170
2100 NEXT J:PRINT
2110 GOSUB 2140:PRINT:PRINT
2120 GOSUB 1900:PRINT:PRINT:STOP
2130 REM
2140 PRINT TAB(20)"  -  -  -  -  5  -  -  -  - 10  -  -  -  - 15  -  -  -  ";
2150 PRINT"- 20  -  -  -  - 25":RETURN
2160 RETURN
2170 IF A<1 THEN PRINT TAB(20)"]":GOTO 2200
2180 IF A<2 THEN PRINT TAB(20)"]]":GOTO 2200
2190 PRINT TAB(20);:FOR K=1 TO A:PRINT"]";:NEXT K:PRINT
2200 RETURN
2210 REM
2220 REM
2230 STOP
2240 REM
2250 REM
2200
2190 PRINT TAB(20);:FOR K=1 TO A:PRINT"]";:NEXT K:PRINT
2200 RETURN
2210 REM
2220 REM
2230 STOP