1987 Federal Income Tax Calculator

Developer(s): Herb Bowers
Date: 1988
Type: Program
Platform(s): TS 2068
Tags: Tax

Calculates 1987 US federal income tax. It asks for your filing status, the number of dependents, whether you (and a spouse on a joint return) are 65 or older or blind, adjusted gross income, net long-term capital gain, itemized deductions and the federal tax withheld. It then chooses the larger of the standard deduction (with the 1987 additional amounts for age and blindness) or the itemized total, subtracts $1,900 per exemption, and works out the tax. A summary screen lists each step and ends with the refund due or the amount owed.

The REM credits Herb Bowers, Sr., and calls it public-domain software as printed in Time Designs, January/February 1988, where it appeared as “1987 Federal Income Tax Calculator”.

Program Analysis

Structure

  • Lines 110–420: the questions. A FOR f=0 TO fs=2 loop asks the age and blindness questions once, or twice for a joint return.
  • Lines 440–460: additional standard deduction, standard deduction by filing status, and taxable income.
  • Lines 470–540: the summary and the refund or balance due.
  • Lines 1000–1250: the tax: tiny amounts directly, table-style calculation under $50,000, schedule calculation above it or when capital gains apply.
  • Lines 1300–1550: the rate schedules for the four filing-status groups.

Tax Tables and Schedules

For taxable income under $50,000 with no capital-gain adjustment, the program imitates the printed IRS tax table: it finds the $25 bracket (or $50 above $3,000) containing the income, computes the schedule tax at both ends and averages them, which is how the tables were built. Above $50,000 it applies the X, Y or Z schedule directly. When taxable income is above the threshold for the filing status, net capital gain is taxed at 28% and taken out of the schedule calculation.

Notable Techniques

  • The rate schedules are stored as one fixed-width string per filing status in d$ instead of DATA: each 12-character field holds the bracket top, the base tax and the percentage, read back with VAL d$(f TO f+2) and so on. The top bracket uses 9E9 as an open upper limit and a 38.5% rate.
  • Amounts are worked in hundreds (l=ta/100), so the 3-digit bracket limits in the strings stand for dollars in hundreds.
  • Many choices use logical expressions as numbers, for example ex+1+(fs=2) for exemptions and "Are you" AND NOT f to change the question text for a spouse.

Potential Issues

  • Only the 1987 figures are built in; the program is not valid for other years.
  • Filing status and other answers are not checked, so a status outside 1–5 gives a standard deduction of zero, and only answers beginning with Y count as yes.

This program came from an Oliger (JLO SAFE) disk and was converted to load from tape. The values saved with the disk copy, which included a completed set of figures, were cleared so that it starts empty. Nothing else needed changing. It was tested in ZEsarUX.

Appears On

Music with pictures, printer utilities, drawing tools, games and home programs: over fifty programs from the SINCUS library tape that followed tape 103, rescued from disk.

Related Articles

Program to calculate 1987 taxes.

Related Content

Image Gallery

Source Code

    1 REM Federal TAX Calculator      by Herb Bowers, Sr. PD software as in TDM Jan/Feb 88
    2 REM Info input
  110 CLS : PRINT AT 8,0;"Enter Filing status:";TAB 4;"1. Single";TAB 4;"2. Married Filing JOINT";TAB 4;"3. Married Filing SEPARATE";TAB 4;"4. Head of Household";TAB 4;"5. Qualifying widow/er": INPUT fs
  130 CLS 
  135 POKE 23658,8
  140 PRINT AT 9,0;"How many dependents BESIDES you";" and your spouse" AND fs=2;"?";TAB 4;"If none then ENTER 0"
  150 INPUT ex
  160 LET ex=ex+1+(fs=2)
  165 LET aa=0
  170 FOR f=0 TO fs=2
  180 CLS 
  190 PRINT AT 9,0;"Are you" AND NOT f;"Is spouse" AND f;" 65 or older";TAB 12;" Y or N"
  200 INPUT i$
  210 LET aa=aa+(i$(1)="Y")
  220 CLS 
  230 PRINT AT 9,0;"Are you" AND NOT f;"Is spouse" AND f;" Blind?";TAB 12;"Y or N": INPUT i$
  250 LET aa=aa+(i$(1)="Y")
  260 NEXT f
  270 CLS 
  280 PRINT AT 9,0;"Enter Adjusted Gross Income","Form 1040, Line 31;","or 1040A Line 13","or 1040EZ Line 3"
  290 INPUT ag
  300 CLS 
  310 PRINT AT 9,0;"Enter net long term capital gain(smaller of Line 17 or 18, sch.D)(if 0 or less then enter 0)"
  320 INPUT cg
  400 CLS 
  410 PRINT AT 9,0;"Enter total itemized deductions","line 26,schedule A","(if NONE then enter 0)"
  420 INPUT id
  430 CLS 
  435 REM stand deduct calculation
  440 IF aa THEN LET aa=((fs=1)*(((aa=1)*1210)+(aa=2)*1960))+((fs=2 OR fs=5)*(((aa=1)*1840)+((aa>=2)*2440)))+((fs=3)*(((aa=1)*1220)+(aa=2)*1820))+((fs=4)*(((aa=1)*2610)+(aa=2)*3360))+((aa>2)*600)+((aa>3)*600)
  450 LET sd=(2540*(fs=1 OR fs=4))+(3760*(fs=2 OR fs=5))+(1860*(fs=3))+aa
  460 LET ta=ag-((sd>=id)*sd)-((id>sd)*id)-ex*1900
  462 PRINT ,,"Enter total Federal withholding": INPUT wh
  465 REM info to screen
  469 CLS 
  470 PRINT ,,"*FEDERAL INCOME TAX CALCULATION*",,"Filing status= ";fs,"Exemptions= ";ex,,"Adjusted Gross Income= ";ag,,,"less: ";ex;" Exemption";"s" AND ex>1;"*1900= ";ex*1900,"less: Itemized Ded.= ";id AND id>sd,"less: Standard Ded.= ";sd AND sd>=id,,,"Taxable income= ";ta*(ta>0),,,"Net Capital gain= ";cg,,,"tax liability= ";
  480 GO SUB 1000
  490 PRINT TAX'"BEFORE CREDITS OR ADD'L TAXES"
  520 LET l=wh-tax
  530 PRINT AT 19,0;"Total Federal withheld= ";WH,,,"Your refund is: " AND l>=0;"You owe: " AND l<0;"$";ABS l
  540 STOP 
 1000 REM tax calculator control
 1005 REM input ta=taxable amt                  cg=capital gain                 fs=filing status
 1010 IF ta>=25 THEN GO TO 1040
 1020 LET tax=(ta>=5)+(ta>=15)
 1030 RETURN 
 1035 REM separate captl gain
 1040 LET mx=(27000*(fs=1))+(45000*(fs=2 OR fs=5))+(22500*(fs=3))+(38000*(fs=4))
 1050 LET cgt=(cg*.28)*(ta>mx)
 1060 LET cga=cg*(cgt>0)
 1070 LET l=(ta-cga)/100
 1080 IF NOT cga AND ta<50000 THEN GO TO 1140
 1090 REM x-y-z schedules
 1100 GO SUB 1300
 1110 LET tax=INT ((l+cgt)+.5)
 1120 RETURN 
 1130 REM tax tables set up brackets
 1140 LET br=25+((l>30)*25)
 1150 LET b1=INT (ta/br)
 1160 LET b2=b1*br
 1170 LET b3=b2+br
 1180 LET l=b2/100
 1185 REM brgin calculation
 1190 GO SUB 1300
 1200 LET l1=l
 1210 LET l=b3/100
 1220 GO SUB 1300
 1230 LET l2=l
 1240 LET tax=INT ((l1+l2)/2+.5)
 1245 REM end calculations
 1250 RETURN 
 1300 REM data converter
 1310 LET lo=0
 1320 GO SUB 1500
 1330 FOR f=1 TO 60 STEP 12
 1340 LET hi=VAL d$(f TO f+2)
 1350 LET plus=VAL d$(f+3 TO f+7)
 1360 LET pct=VAL d$(f+8 TO f+11)
 1370 IF l>lo AND l<=hi THEN GO TO 1400
 1380 LET lo=hi
 1390 NEXT f
 1395 REM upper/lower parameter     bracket tax
 1400 LET l=(l-lo)*pct+plus
 1410 RETURN 
 1500 REM psuedo-data
 1510 REM single
 1515 IF fs=1 THEN LET d$="0180000000111680019800152700244800285400530400359E91475438.5"
 1520 REM joint;Q/W
 1524 IF fs=2 OR fs=5 THEN LET d$="0300000000112800033000154500408000289000884000359E92459038.5"
 1530 REM married file sep.
 1535 IF fs=3 THEN LET d$="0150000000111400016500152250204000284500442000359E91229538.5"
 1540 REM head of household
 1545 IF fs=4 THEN LET d$="0250000000112300027500153800335000288000755000359E92225038.5"
 1550 RETURN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.