--- title: "InvTax" id: 57172 type: "computer_media" slug: "invtax" url: "http://localhost/computer_media/invtax/" markdown_url: "http://localhost/computer_media/invtax.md" published_at: "2024-10-04T01:15:39+00:00" modified_at: "2026-03-30T21:19:12+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/121_InTx.png" excerpt: "This accounting program calculates FIFO vs. LIFO inventory costs and progressive income taxes across three years, revealing exactly how your costing method affects the tax bill." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Finance" slug: "finance" taxonomy: "genre" url: "http://localhost/type/finance/" media_contents: - id: 56733 title: "Timex Sinclair Public Domain Library Tape 1002" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1002/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/121_InTx.png" media_type_tags: "Finance" --- # InvTax INVTAX is a business accounting program that computes and compares net income and income tax liability under two inventory costing methods — FIFO (First In, First Out) and LIFO (Last In, First Out) — across three consecutive years. The user inputs sales, three purchase figures, beginning inventory, operating expenses, and ending inventory values for each method and each year; the program then calculates cost of goods sold and pre-tax income accordingly. Tax computation is delegated to a subroutine at line 700 that implements a five-bracket progressive tax schedule with rates of 17%, 20%, 30%, 40%, and 46%, using INT() to truncate fractional cents. Results are presented in a columnar LIFO/FIFO comparison table for all three years. *** ## Program Analysis ### Program Structure The program is organized into four logical phases: 1. **Input collection** (lines 10–118): prompts for sales (`S`), three purchase amounts (`P1`–`P3`), beginning inventory (`B`), expenses (`E`), three FIFO ending inventories (`F1`–`F3`), and three LIFO ending inventories (`L1`–`L3`). Each `INPUT` is followed by a `PRINT` echo for verification. 2. **Income calculation** (lines 130–180): derives six pre-tax net income figures — `N1`–`N3` for FIFO and `N4`–`N6` for LIFO — using the cost-of-goods-sold formula: Sales − (Opening Inventory + Purchases − Closing Inventory) − Expenses. 3. **Tax computation** (lines 190–360): calls the tax subroutine at line 700 six times (once per income figure), storing results in `T1`–`T6`. 4. **Output** (lines 500–670): prints a side-by-side LIFO/FIFO table for each of the three years, then halts at line 900. ### Tax Subroutine (Line 700) The subroutine at line 700 implements a five-bracket progressive corporate tax schedule. The income variable `I` is tested with a cascading series of `IF…THEN GOTO` guards, and the tax `T` is computed using base amounts plus a marginal rate on the excess. `INT()` is used throughout to truncate to whole dollars. | Income Range | Base Tax | Marginal Rate | | --- | --- | --- | | ≤ $25,000 | $0 | 17% | | $25,001 – $50,000 | $4,250 | 20% | | $50,001 – $75,000 | $9,250 | 30% | | $75,001 – $100,000 | $16,750 | 40% | | > $100,000 | $26,750 | 46% | This bracket structure corresponds roughly to the US Tax Reform Act of 1978 era corporate rates, consistent with the program’s educational accounting context. ### Notable Bugs and Anomalies The program contains two significant bugs in the after-tax income calculation block (lines 440–490): - **Line 450**: `LET T2=N2-T2` overwrites the tax variable `T2` with the after-tax income for FIFO Year 2. The intended variable was almost certainly `I2` (as used at line 610: `PRINT …;I2`). Because `I2` is never assigned, it will print as 0, and the true tax amount `T2` is destroyed — corrupting both Year 2 output lines (600 and 610). - **Line 670**: The Year 3 output block prints pre-tax income and taxes for LIFO and FIFO (lines 640–650) but is missing the final `PRINT "NET INCOME AFTER TAX"; I6; I3` line that would mirror the structure of Years 1 and 2. The program jumps directly to `GOTO 900` at line 680, so Year 3 after-tax figures are never displayed. ### Key BASIC Idioms - Input echo via `PRINT` immediately after each `INPUT` (e.g., lines 21, 32, 35) provides a paper-trail-style confirmation of entered values. - The tax subroutine uses the classic Sinclair-BASIC pattern of cascading `IF I>threshold THEN GOTO` tests falling through to a default case, with all branches converging on a single `RETURN` at line 765. - `GOSUB 700` / `RETURN` is used repeatedly to avoid duplicating the tax bracket logic for each of the six income scenarios. - Line numbers are spaced in multiples of 10 (with occasional fills at ×1 and ×5 intervals) to allow later insertion of lines — a common BASIC maintenance practice. ### Program Termination After output, line 680 branches to `STOP` at line 900, bypassing lines 910–920. Line 920 (`RUN`) would restart the program if reached, but is never executed in normal flow. ## Source Code ``` 5 REM INVTAX(INVENTORY COSTING AD INCOME TAXES 6 PRINT TAB (10);"INVTAX" 7 PRINT "A PROGRAM FOR INVENTORY COSTING AND INCOME TAXES" 8 PRINT 10 PRINT "ENTER SALES" 20 INPUT S 21 PRINT S 30 PRINT "ENTER PURCHASE 1" 31 INPUT P1 32 PRINT P1 33 PRINT "ENTER PURCHASE 2" 34 INPUT P2 35 PRINT P2 36 PRINT "ENTER PURCHASE 3" 37 INPUT P3 38 PRINT P3 50 PRINT "ENTER BEG.INVENTORY" 60 INPUT B 61 PRINT B 70 PRINT "ENTER EXPENSES" 80 INPUT E 81 PRINT E 90 PRINT "ENTER FIFO INV.FOR YEAR 1" 91 INPUT F1 92 PRINT F1 93 PRINT "ENTER FIFO INV.FOR YEAR 2" 94 INPUT F2 95 PRINT F2 96 PRINT "ENTER FIFO INV. FOR YEAR 3" 97 INPUT F3 98 PRINT F3 110 PRINT "ENTER LIFO INV. FOR YEAR 1" 111 INPUT L1 112 PRINT L1 113 PRINT "ENTER LIFO INV. FOR YEAR 2" 114 INPUT L2 115 PRINT L2 116 PRINT "ENTER LIFO INV. FOR YEAR 3" 117 INPUT L3 118 PRINT L3 130 LET N1=S-(B+P1-F1)-E 140 LET N2=S-(F1+P2-F2)-E 150 LET N3=S-(F2+P3-F3)-E 160 LET N4=S-(B+P1-L1)-E 170 LET N5=S-(L1+P2-L2)-E 180 LET N6=S-(L2+P3-L3)-E 190 LET I=N1 200 GOSUB 700 210 LET T1=T 220 LET I=N2 230 GOSUB 700 240 LET T2=T 250 LET I=N3 260 GOSUB 700 270 LET T3=T 280 LET I=N4 290 GOSUB 700 300 LET T4=T 310 LET I=N5 320 GOSUB 700 330 LET T5=T 340 LET I=N6 350 GOSUB 700 360 LET T6=T 440 LET I1=N1-T1 450 LET T2=N2-T2 460 LET I3=N3-T3 470 LET I4=N4-T4 480 LET I5=N5-T5 490 LET I6=N6-T6 500 PRINT 510 PRINT TAB (10);"LIFO"; "FIFO" 520 PRINT "YEAR 1" 530 PRINT "NET INCOME BEFORE TAXES";N4;N1 540 PRINT "INCOME TAX";T4;T1 550 PRINT "NET INCOME AFTER TAXES";I4;I1 570 PRINT 580 PRINT "YEAR 2" 590 PRINT "NET INCOME BEFORE TAXES";N5;N2 600 PRINT "INCOME TAXES";T5;T2 610 PRINT "NET INCOME AFTER TAX";I5;I2 620 PRINT 630 PRINT "YEAR 3" 640 PRINT "NET INCOME BEFORE TAXES";N6;N3 650 PRINT "INCOME TAX";T6;T3 670 PRINT "NET INCOME AFTER TAX";I6;I3 680 GOTO 900 700 IF I>100000 THEN GOTO 730 705 IF I>75000 THEN GOTO 740 710 IF I>50000 THEN GOTO 750 715 IF I>25000 THEN GOTO 760 720 LET T=INT (.17*I) 725 GOTO 765 730 LET T=26750+INT (.46*(I-100000)) 735 GOTO 765 740 LET T=16750+INT (.40*(I-75000)) 745 GOTO 765 750 LET T=9250+INT (.30*(I-50000)) 755 GOTO 765 760 LET T=4250+INT (.20*(I-25000)) 765 RETURN 900 STOP 910 SAVE "1012%1" 920 RUN ```