Classic Computer Magazine Archive COMPUTE! ISSUE 17 / OCTOBER 1981 / PAGE 76

THE apple® GAZETTE

Budgeting On The Apple

William R. Swinyard
Provo, UT

When I sat down at one of the University's dozens of Apples six weeks ago, someone had to show me where the on/off switch was. But I learned fast and, within a few weeks, I was doing pretty well at what I believed the Apple to be best at. I had maintained several "high score" records on Apple Invaders ... I was terrific at judging angle and windspeed in the Bombs game ... and I was even learning how to back away from brick walls in Maze. But I had not entered even one real line of programming.

One other thing I did discover, though, was how ... well, nice the Apple is. True, I had spent a little programming time on our DEC installation (and a lot of time on it using canned analytical software packages), but I always felt inhibited about getting too intimate with that machine because of its so formal, even intimidating, way of speaking — or should I say "shouting" — back. "FATAL PROCESSING ERROR. ILLEGAL CHARACTER IN DATA (K) [OCTAL 113] UNIT = 8/ACCESS = SEQUIN/MODE = ASCII," was typical of the helpful way the DEC had about it. What a contrast with the Apple! It almost seemed to invite me to stay with it just a bit longer, and even to try running a few little programs on it.

And so I did. This article is about one of the first. It simply permits the user to enter a monthly income figure then displays a budget, along with the discrepancy between the budget and the income. It has a few nice touches, I think. Program requests for budget changes are highlighted in a new budget display, there is a short subroutine to align the decimal points, and percentages of total budget are also displayed.

Briefly, here are what the sections of the program do:

Line 115 — Displys the title of the program on an otherwise blank screen for a few seconds.

Line 120 — Requests monthly income information.

Lines 240-570 — Lists out, with illustrative budget figures, the items appropriate for my budget. Yours may be different, and you will need to change the program listing where appropriate.

Lines 600-680 — Prints the output headings, the budget name and corresponding value, the total budget figure, and the deviation between income and budget.

Lines 690-775 — The above information is displayed for about 10 seconds, followed by requests for updated expenditures originating in these lines. If updates are made, a new display table is printed which highlights (with underlining) the updated expenditure figure.

Lines 780-830 — A subroutine for lining up the decimals.

Lines 835-900 — Prints out the fully revised expenditures table, but accompanied this time with percentage allocations of budget, if requested.

The tabular display has been arranged to just fit into the Apple screen, so a line printer is unnecessary to get full use of this program.

Several refinements to the program might make it yet more appealing for your use, but seemed like overkill for me. With little modification the program could be designed to display budget values and percentages in the first tabular display — only one extra FOR-NEXT loop would be required. The program could easily be rewritten to make it interactive in budget-area development, though this seems unnecessary for a family whose budget allocations typically fall into the same areas each month. Or the program could be easily modified to accommodate input of gross monthly income, and incorporate federal and state tax withholding information, FICA withholding, tax-deferred income, etc. by building in the appropriate with-holding proportions (income level, number of exemptions, and claimed marital status would be required as input values). However, since Uncle Sam has been changing the FICA rates annually, I passed this improvement by in favor of the relative permanency of the program as it now stands. Still, if you are interested in simulating the effect of increasing or decreasing your number of exemptions, this modification could be worthwhile.

Figure 1 shows the initial output display after entering a net monthly income figure. Figure 2 shows the output following the program's request for any changes. You can see that the change was made ("Med. and Dent.") and was highlighted with a short underline. After all changes have been made, the program gives you the option of requesting percentage breakdowns by budget area. This table is shown in Figure 3, which concludes the budgeting routine.

There is nothing very sophisticated about any of this, but the program has been a useful one for our family; there is nothing quite so engaging as seeing an inanimate "object" spring to life at your bidding. And the program was just a lot of fun to write. Let me know of your improvements of it.

Program 1.

10 REM *********************
20 REM *HOME BUDGETING PROGRAM*
30 REM *CREATED JUNE 10, 1981 *
40 REM *BY WILLIAM R. SWINYARD*
50 REM *SHOWS AND CALCULATES *
60 REM *DISTRIBUTION OF INCOME*
70 REM *INTO BUDGET CATEGORIES*
80 REM *INCLUDING REQUESTS FOR*
90 REM *UPDATED EXPENDITURES &*
100 REM *FOR PERCENTAGE DISPLAY*
110 REM ************************
115 HOME : PRINT : PRINT : PRINT : PRINT : PRINT : PRINT TAB(10)"HOME BUDGETING PROGRAM" : FOR I = 1 TO 1000 : NEXT I : HOME
120 INPUT "WHAT IS NET MONTHLY INCOME? " ; SALARY
130 PRINT
232 DIM DD(17), DD$(17)
236 REM **BUDGETED ITEMS IN LISTING **
237 REM **TO CHANGE BUDGET YOU MUST ACCESS THE LISTING DIRECTLY**
240 DD$(1) = "HOUSING"
250 DD(1) = 500
260 DD$(2) = "HEAT"
270 DD(2) = 50
280 DD$(3) = "LIGHTS"
290 DD(3) = 35
300 DD$(4) = "DONATIONS"
310 DD(4) = 50
320 DD$(5) = "TELEPHONE"
330 DD(5) = 35
340 DD$(6) = "LOAN PAYMNTS"
350 DD(6) = 100
360 DD$(7) = "MED & DENT"
370 DD(7) = 35
380 DD$(8) = "GROCERIES"
390 DD(8) = 300
400 DD$(9) = "AUTO MAINT."
410 DD(9) = 25
420 DD$(10) = "GASOLINE"
430 DD(10) = 100
440 DD$(11) = "INSURANCE"
450 DD(11) = 50
470 DD$(12) = "CLOTHING"
480 DD(12) = 50
490 DD$(13) = "EDUCATION"
500 DD(13) = 20
510 DD$(14) = "HOME REPAIR"
520 DD(14) = 50
530 DD$(15) = "RECREATION"
540 DD(15) = 60
550 DD$(16) = "SAVINGS"
560 DD(16) = 50
570 DD$(17) = "OTHER"
580 REM ***PRINT OUTPUT***
590 HOME
600 PRINT "MONTHLY INCOME", SALARY
605 PRINT "=============="
610 SUM = 0
620 FOR I = 1 TO 17
630 GOSUB 790 : PRINT TAB(A)I ; TAB(4) DD$(I) ; TAB( B)DD(I)
635 IF I = TT THEN PRINT TAB(18)"---"
640 SUM = SUM + DD(I)
650 NEXT I
660 PRINT
670 PRINT "TOTAL BUDGETED = " ; SUM
680 PRINT "NET AFTER BUDGET = " ; SALARY - SUM
685 IF Q = 1 THEN GOTO 910
690 FOR X = 1 TO 10000 : NEXT X
700 PRINT "******************"
710 REM ***CHANGES***
730 INPUT "WAS SPENDING OTHER THAN ABOVE?" ; B$
740 IF B$ = "N" THEN GOTO 840
750 INPUT "TYPE ITEM NUMBER, ACTUAL EXPEND. " ; I, X
760 TT = I
770 DD(I) = X
775 GOTO 600
780 REM SUBROUTINE FOR DECIMAL PLACEMENT
790 A = 2 : B = 19 : C = 25
800 IF I > 9 THEN A = A - 1
810 IF DD(I) < 10 THEN B = B + 1
820 IF DD(I) > = 100 AND DD(I) (1000 THEN B = B - 1
825 IF DD(I) > = 1000 THEN B = B - 2
827 IF PC > 9 THEN C = C - 1
830 RETURN
835 REM ROUTINE TO COMPUTE & PRINT %'S
840 INPUT "WANT %'S OF BUDGET? " ; C$
850 IF C$ = "N" THEN GOTO 910
855 PRINT : PRINT
860 FOR I = 1 TO 17
865 Q = 0
870 PC = (DD(I) / SUM) * 100
880 GOSUB 790 : PRINT TAB ( A)I, TAB(4) DD$(I) ; TAB( B) DD(I), TAB(C) INT (PC) ; "%"
890 NEXT I
895 Q = 1
900 GOTO 660
910 END

Figure 1.

HOME BUDGETING PROGRAM
WHAT IS NET MONTHLY INCOME? 1600
MONTHLY INCOME 1600
==============
1 HOUSING 500
2 HEAT 50
3 LIGHTS 35
4 DONATIONS 50
5 TELEPHONE 35
6 LOAN PAYMNTS 100
7 MED & DENT 35
8 GROCERIES 300
9 AUTO MAINT. 25
10 GASOLINE 100
11 INSURANCE 50
12 CLOTHING 50
13 EDUCATION 20
14 HOME REPAIR 50
15 RECREATION 60
16 SAVINGS 50
17 OTHER 0
TOTAL BUDGETED = 1510
NET AFTER BUDGET = 90

Figure 2.

WAS SPENDING OTHER THAN ABOVE? Y
TYPE ITEM NUMBER, ACTUAL EXPEND. 7, 75
MONTHLY INCOME  1600
==============
1 HOUSING 500
2 HEAT 50
3 LIGHTS 35
4 DONATIONS 50
5 TELEPHONE 35
6 LOAN PAYMNTS 100
7 MED & DENT 75
8 GROCERIES 300
9 AUTO MAINT. 25
10 GASOLINE 100
11 INSURANCE 50
12 CLOTHING 50
13 EDUCATION 20
14 HOME REPAIR 50
15 RECREATION 60
16 SAVINGS 50
17 OTHER 0
TOTAL BUDGETED = 1550
NET AFTER BUDGET = 50

Figure 3.

WAS SPENDING OTHER THAN ABOVE?
WANT %'S OF BUDGET? Y
1 HOUSING 500 32%
2 HEAT 50 3%
3 LIGHTS 35 2%
4 DONATIONS 50 3%
5 TELEPHONE 35 2%
6 LOAN PAYMNTS 100 6%
7 MED & DENT 75 4%
8 GROCERIES 300 19%
9 AUTO MAINT. 25 1%
10 GASOLINE 100 6%
11 INSURANCE 50 3%
12 CLOTHING 50 3%
13 EDUCATION 20 1%
14 HOME REPAIR 50 3%
15 RECREATION 60 3%
16 SAVINGS 50 3%
17 OTHER 0 0%
TOTAL BUDGETED = 1550
NET AFTER BUDGET = 50