This program calculates estimated U.S. federal income tax liability for the years 1987, 1988, and 1989 using the tax brackets and rules introduced by the Tax Reform Act of 1986. It supports all four filing statuses (single, married filing jointly, married filing separately, and head of household) and handles standard or itemized deductions, IRA deductions, Social Security income inclusion calculations, and age/blindness additional deductions. The 1987 tax year uses a transitional five-bracket structure with rates of 11%, 15%, 28%, 35%, and 38.5%, while 1988 and 1989 use the simplified two-bracket system at 15% and 28%. Non-mortgage interest deductions are phased down across the three years at 65%, 40%, and 20% respectively, reflecting the statutory phase-out schedule. The program uses a GOSUB at line 1180 for the itemized deductions subroutine and relies on chained IF statements rather than a branching table for tax bracket calculations.
Program Analysis
Program Structure
The program is organized into a linear input-and-calculation flow followed by filing-status dispatch, with one subroutine for itemized deductions. The major sections are:
- Lines 10–100: Introduction, instructions, and keypress pauses.
- Lines 110–180: Input collection — filing status, exemptions, age/blindness, income items.
- Lines 190–320: Social Security taxability calculation and adjusted gross income (AGI) computation.
- Lines 330–580: Deduction routing — either standard deduction table (lines 430–580) or itemized deductions subroutine (line 1180).
- Lines 590–730: Display of exemptions, deductions, and taxable income for all three years.
- Lines 740–1170: Filing-status dispatch and tax bracket computation, split into four blocks (single 780–870, MFJ 880–970, HH 980–1070, MFS 1080–1170), each ending with
STOP. - Lines 1180–1480: Itemized deductions subroutine including floor comparisons against standard deduction amounts.
- Line 1490:
SAVEcommand.
Key Variables
| Variable | Meaning |
|---|---|
c$ | Filing status code (“s”, “mj”, “ms”, “hh”) |
a | Number of personal exemptions (self + spouse) |
a1 | Age/blindness additional deduction count (scaled by 0.8 for joint/separate filers) |
b | Number of dependents |
b1 | Total ordinary income (wages + interest + dividends + pension + other) |
g | IRA deduction |
j | Total Social Security benefits received |
j2 | Taxable portion of Social Security |
agi | Adjusted gross income |
h7, h8, h9 | Deduction amounts for 1987, 1988, 1989 |
ti87, ti88, ti89 | Taxable income for each year |
Social Security Taxability Calculation
Lines 240–300 implement the IRC §86 formula for determining the taxable portion of Social Security benefits. The base amounts (l) are set by filing status: $25,000 for single and head of household, $32,000 for married filing jointly, and $0 for married filing separately. The provisional income calculation at line 270 is:
j1 = ((j/2 + b1 + k) - g - l) / 2
The taxable amount j2 is then clamped to the lesser of j1 and half of total Social Security (j/2), and floored at zero. This correctly models the 50% inclusion rule in effect for the covered tax years.
Age and Blindness Additional Deductions
Variable a1 counts the combined number of age-65-or-over and blind conditions across the taxpayer and spouse (line 150). For married filing jointly or separately filers, line 160 scales this count by 0.8, which reflects the per-person additional standard deduction amount of $600 (married) versus $750 (single/HH) — effectively, each such condition contributes $750×0.8 = $600 in the later deduction calculations at lines 630–650. The check at line 150 rejects values of 5 or more as erroneous, since a couple can have at most four qualifying conditions.
Standard Deduction Assignment
Lines 430–580 assign standard deduction amounts for all three years by filing status and age/blindness flag. The 1987 amounts (h7) differ from 1988/1989 (h8/h9) because 1987 was a transitional year under the Tax Reform Act of 1986 with lower standard deduction floors. For married filing jointly, the 1987 base is $3,760 (no elderly/blind) or $5,000 (with elderly/blind), rising to a flat $5,000 for 1988–1989.
Tax Bracket Calculations
Each filing-status block computes tax using a chain of IF statements — one per bracket boundary — rather than a loop or array. The 1987 transitional brackets use five rates (11%, 15%, 28%, 35%, 38.5%); the 1988 and 1989 brackets use only two rates (15%, 28%). Each bracket line computes tax as a base amount plus the marginal rate applied to income above the bracket floor. Because the conditions are not mutually exclusive (they use simple greater-than comparisons without AND upper bounds on some lines), only one IF per income level will evaluate to true given that conditions are strictly ordered.
Itemized Deductions Subroutine (Lines 1180–1480)
The subroutine collects itemized deduction components and applies year-specific rules. Non-mortgage interest (c5) is deductible at 65% for 1987, 40% for 1988, and 20% for 1989, consistent with the phase-out schedule enacted by the Tax Reform Act. Medical expenses are reduced by 7.5% of AGI (line 1220–1230). After computing raw itemized totals, lines 1320–1470 perform a floor comparison: if the computed itemized amount is less than the applicable standard deduction for the filer’s status and age/blindness, the standard deduction amount is substituted. This ensures the taxpayer always receives at least the standard deduction benefit.
Control Flow Idioms
PAUSE NOT PI(lines 70, 100, 1200) — sincePIis non-zero,NOT PIevaluates to 0, makingPAUSE 0which waits indefinitely for a keypress. This is a standard Sinclair BASIC idiom.- Double-tested filing status rejection at lines 120–130: the condition is evaluated twice, once to print the error message and once to branch back, avoiding a
GO TOinside a compoundIF ... THEN ... : IF ... THENchain. - Filing-status dispatch at lines 740–770 uses four consecutive
GO TOstatements; since one must match, only one will execute. - Each filing-status block ends with
STOPto prevent fall-through into the next block.
Potential Anomalies
- Line 390 accepts both
"y"and"Y"for itemize choice, but theINPUTprompt asks for(y/n); lowercase"n"and uppercase"N"are treated identically (neither triggers the subroutine), so this is not a bug but case handling is asymmetric. - Variable
l(the Social Security base amount) shares its name visually with the digit1in some fonts, which could cause confusion when reading the listing, though it is not an error. - The program does not handle the 5% surtax that applied to high-income taxpayers in 1988 under the original Tax Reform Act, meaning tax estimates for very high incomes in 1988–1989 may be slightly understated.
- Lines 630–650 always print deduction amounts using
h7+(a1*750)etc., even when itemizing. After the subroutine returns,h7/h8/h9hold itemized totals (already floored against standard deduction), so these printed values will reflect itemized amounts rather than just the standard deduction, which is correct behavior.
Content
Source Code
10 CLS
20 REM "inc tx 789" - revised 11/25/86
30 REM - by Max Schoenfeld
40 PRINT '''"Max's fast income tax program!!"
50 PRINT '" Please note that tax rate break points (income levels at which the tax rate shifts upwards) will be indexed for in-flation beginning in 1989. So will deduction amounts. Exemp- tion amounts will be indexed beginning in 1990. No allowancefor these changes can be pre- dicted and so are not in this program."
60 PRINT '''" Press any key when ready."
70 PAUSE NOT PI: CLS
80 PRINT "Answer all questions with the amount asked for. Enter zero ifquestion does not apply to you. Do not use commas in numbers. (For example, enter 5000, not 5,000.) Press ENTER button after answering each question."
90 PRINT '"Press any key when ready."
100 PAUSE NOT PI: CLS
110 INPUT "What is your filing status?","s - single;",,"mj - married filing jointly; ms - married filing separately; hh - head of household.";c$
120 IF c$<>"s" AND c$<>"mj" AND c$<>"ms" AND c$<>"hh" THEN PRINT "Wrong filing status. Start over": PAUSE 100: CLS
130 IF c$<>"s" AND c$<>"mj" AND c$<>"ms" AND c$<>"hh" THEN GO TO 110
140 INPUT "Count your number of exemptions.(One each for self and spouse.) ";a
150 INPUT "Count the number 65 and over, and the number blind ";a1: IF a1>=5 THEN PRINT "Wrong answer. Please make correct entry.": PAUSE 60: GO TO 150
160 IF c$="mj" OR c$="ms" THEN LET a1=.8*a1
170 CLS : INPUT "List number of dependents. ";b
180 INPUT "Wages, salaries, tips? ";c: INPUT "Interest income? ";d: INPUT "Dividend income? ";e: INPUT "Taxable pension? ";f: INPUT "Total other taxable income"'"(rents, capital gains, IRA dis- bursements, etc.)? ";p
190 LET b1=c+d+e+f+p
200 PRINT '"If you have no pension plan at work you may deduct up to $2,000each for an IRA. If you do","have a pension plan you may also deduct up to $2000 each providing your adjusted gross income is less than$ 25,000 for singles and $40,000 for joint filers."
210 INPUT "Any IRA deduction? ";g
220 INPUT "Your Social Security? ";j
230 INPUT "Any non-taxable interest? ";k
240 IF c$="s" OR c$="hh" THEN LET l=25000
250 IF c$="mj" THEN LET l=32000
260 IF c$="ms" THEN LET l=0
270 LET j1=((j/2+b1+k)-g-l)/2
280 IF j1<=j/2 THEN LET j2=j1
290 IF j1>j/2 THEN LET j2=j/2
300 IF j1<=0 THEN LET j2=0
310 PRINT "There is no longer a deduction for married couples who both work."
320 CLS : PAUSE 60
330 PRINT "Your total income is $ ";b1+j2
340 LET agi=b1+j2-g
350 PRINT '"Your Adjusted Gross Income is $ ";agi
360 PRINT '
370 PRINT "You can no longer deduct for charitable contributions unless you itemize."
380 PRINT
390 INPUT "Do you wish to itemize deduc- tions (y/n)? ";d$
400 IF d$="y" OR d$="Y" THEN GO SUB 1180
410 PRINT : IF d$="y" OR d$="Y" THEN GO TO 590
420 PRINT
430 IF c$="s" AND a1=0 THEN LET h7=2540
440 IF c$="s" AND a1>=1 THEN LET h7=3000
450 IF c$="s" THEN LET h8=3000
460 IF c$="s" THEN LET h9=3000
470 IF c$="mj" AND a1=0 THEN LET h7=3760
480 IF c$="mj" AND a1>=.8 THEN LET h7=5000
490 IF c$="mj" THEN LET h8=5000
500 IF c$="mj" THEN LET h9=5000
510 IF c$="ms" AND a1=0 THEN LET h7=1880
520 IF c$="ms" AND a1>=.8 THEN LET h7=2500
530 IF c$="ms" THEN LET h8=2500
540 IF c$="ms" THEN LET h9=2500
550 IF c$="hh" AND a1=0 THEN LET h7=2540
560 IF c$="hh" AND a1>=1 THEN LET h7=4400
570 IF c$="hh" THEN LET h8=4400
580 IF c$="hh" THEN LET h9=4400
590 PAUSE 60: CLS
600 PRINT "1987 exemptions - $ "; ((a+b)*1900)
610 PRINT "1988 exemptions - $ "; ((a+b)*1950)
620 PRINT "1989 exemptions - $ "; ((a+b)*2000)
630 PRINT '"1987 deduction - $ ";h7+(a1*750)
640 PRINT "1988 deduction - $ ";h8+(a1*750)
650 PRINT "1989 deduction - $ ";h9+(a1*750)
660 PRINT
670 LET ti87=b1+j2-(g+h7)-((a+b)*1900)-(a1*750): IF ti87<=0 THEN LET ti87=0
680 LET ti88=b1+j2-(g+h8)-((a+b)*1950)-(a1*750): IF ti88<=0 THEN LET ti88=0
690 LET ti89=b1+j2-(g+h9)-((a+b)*2000)-(a1*750): IF ti89<=0 THEN LET ti89=0
700 PRINT '"1987 taxable income - $ ";ti87
710 PRINT "1988 taxable income - $ ";ti88
720 PRINT "1989 taxable income - $ ";ti89
730 PRINT
740 IF c$="s" THEN GO TO 780
750 IF c$="mj" THEN GO TO 880
760 IF c$="hh" THEN GO TO 980
770 IF c$="ms" THEN GO TO 1080
780 IF ti87<=1800 THEN PRINT "Your 1987 tax is: $ ";ti87*.11
790 IF ti87>1800 AND ti87<=16800 THEN PRINT "Your 1987 tax is: $ ";198+((ti87-1800)*.15)
800 IF ti87>16800 AND ti87<=27000 THEN PRINT "Your 1987 tax is: $ ";2448+((ti87-16800)*.28)
810 IF ti87>27000 AND ti87<=54000 THEN PRINT "Your 1987 tax is: $ ";5304+((ti87-27000)*.35)
820 IF ti87>54000 THEN PRINT "Your 1987 tax is: $ ";14754+((ti87-54000)*.385)
830 IF ti88<=17850 THEN PRINT "Your 1988 tax is: $ ";(ti88*.15)
840 IF ti88>17850 THEN PRINT "Your 1988 tax is: $ ";2677.5+((ti88-17850)*.28)
850 IF ti89<=17850 THEN PRINT "Your 1989 tax is: $ ";(ti89*.15)
860 IF ti89>17850 THEN PRINT "Your 1989 tax is: $ ";2677.5+((ti89-17850)*.28)
870 STOP
880 IF ti87<=3000 THEN PRINT "Your 1987 tax is: $ ";ti87*.11
890 IF ti87>3000 AND ti87<=28000 THEN PRINT "Your 1987 tax is: $ ";330+((ti87-3000)*.15)
900 IF ti87>28000 AND ti87<=45000 THEN PRINT "Your 1987 tax is: $ ";4080+((ti87-28000)*.28)
910 IF ti87>45000 AND ti87<=90000 THEN PRINT "Your 1987 tax is: $ ";8840+((ti87-45000)*.35)
920 IF ti87>90000 THEN PRINT "Your 1987 tax is: $ ";24590+((ti87-90000)*.385)
930 IF ti88<=29750 THEN PRINT "Your 1988 tax is: $ ";(ti88*.15)
940 IF ti88>29750 THEN PRINT "Your 1988 tax is: $ ";4462.5+((ti88-29750)*.28)
950 IF ti89<=29750 THEN PRINT "Your 1989 tax is: $ ";(ti89*.15)
960 IF ti89>29750 THEN PRINT "Your 1989 tax is: $ ";4462.5+((ti89-29750)*.28)
970 STOP
980 IF ti87<=2500 THEN PRINT "Your 1987 tax is: $ ";ti87*.11
990 IF ti87>2500 AND ti87<=23000 THEN PRINT "Your 1987 tax is: $ ";275+((ti87-2500)*.15)
1000 IF ti87>23000 AND ti87<=38000 THEN PRINT "Your 1987 tax is: $ ";3350+((ti87-23000)*.28)
1010 IF ti87>38000 AND ti87<=80000 THEN PRINT "Your 1987 tax is: $ ";7550+((ti87-38000)*.35)
1020 IF ti87>80000 THEN PRINT "Your 1987 tax is: $ ";22250+((ti87-80000)*.385)
1030 IF ti88<=23900 THEN PRINT "Your 1988 tax is: $ ";(ti88*.15)
1040 IF ti88>23900 THEN PRINT "Your 1988 tax is: $ ";3585+((ti88-23900)*.28)
1050 IF ti89<=23900 THEN PRINT "Your 1989 tax is: $ ";(ti89*.15)
1060 IF ti89>23900 THEN PRINT "Your 1989 tax is: $ ";3585+((ti89-23900)*.28)
1070 STOP
1080 IF ti87<=1500 THEN PRINT "Your 1987 tax is: $ ";ti87*.11
1090 IF ti87>1500 AND ti87<=14000 THEN PRINT "Your 1987 tax is: $ ";165+((ti87-1500)*.15)
1100 IF ti87>14000 AND ti87<=22500 THEN PRINT "Your 1987 tax is: $ ";2040+((ti87-14000)*.28)
1110 IF ti87>22500 AND ti87<=45000 THEN PRINT "Your 1987 tax is: $ ";4420+((ti87-22500)*.35)
1120 IF ti87>45000 THEN PRINT "Your 1987 tax is: $ ";12295+((ti87-45000)*.385)
1130 IF ti88<=14875 THEN PRINT "Your 1988 tax is: $ ";ti88*.15
1140 IF ti88>14875 THEN PRINT "Your 1988 tax is: $ ";2231.25+((ti88-14875)*.28)
1150 IF ti89<=14875 THEN PRINT "Your 1989 tax is: $ ";ti89*.15
1160 IF ti89>14875 THEN PRINT "Your 1989 tax is: $ ";2231.25+((ti89-14875)*.28)
1170 STOP
1180 PRINT "There are many changes in what you can itemize. You can deductmedical expenses over 7.5% of your adjusted gross income. In-come and property taxes are de- ductible, but not sales tax. Mortgage interest, only on two homes, can be deducted. Only a portion of other interest can bededucted. Charitable contribu- tions are O.K. but not other miscellaneous items."
1190 PRINT '"Press any key when ready to","itemize."
1200 PAUSE NOT PI: CLS
1210 INPUT "Total medical expenses? ";a3
1220 LET a4=a3-(agi*.075)
1230 IF a4<0 THEN LET a4=0
1240 INPUT "State and local income taxes? ";b4
1250 INPUT "Real estate taxes? ";b5
1260 INPUT "Mortgage interest (two homes only? ";c4
1270 INPUT "Any non-mortgage interest? Noteonly part will be allowed. ";c5
1280 INPUT "Charitable contributions? ";d3
1290 LET h7=a4+b4+b5+c4+(c5*.65)+d3
1300 LET h8=a4+b4+b5+c4+(c5*.4)+d3
1310 LET h9=a4+b4+b5+c4+(c5*.2)+d3
1320 IF c$="mj" AND a1=0 AND h7<=3760 THEN LET h7=3760
1330 IF c$="mj" AND a1>=.8 AND h7<=5000 THEN LET h7=5000
1340 IF c$="mj" AND h8<=5000 THEN LET h8=5000
1350 IF c$="mj" AND h9<=5000 THEN LET h9=5000
1360 IF c$="s" AND a1=0 AND h7<=2540 THEN LET h7=2540
1370 IF c$="s" AND a1>=1 AND h7<=3000 THEN LET h7=3000
1380 IF c$="s" AND h8<=3000 THEN LET h8=3000
1390 IF c$="s" AND h9<=3000 THEN LET h9=3000
1400 IF c$="hh" AND a1=0 AND h7<=2540 THEN LET h7=2540
1410 IF c$="hh" AND a1>=1 AND h7<=4400 THEN LET h7=4400
1420 IF c$="hh" AND h8<=4400 THEN LET h8=4400
1430 IF c$="hh" AND h9<=4400 THEN LET h9=4400
1440 IF c$="ms" AND a1=0 AND h7<=1880 THEN LET h7=1880
1450 IF c$="ms" AND a1>=.8 AND h7<=2500 THEN LET h7=2500
1460 IF c$="ms" AND h8<=2500 THEN LET h8=2500
1470 IF c$="ms" AND h9<=2500 THEN LET h9=2500
1480 RETURN
1490 SAVE "inc tx 789"
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

