Business #4

Products: Business #4
Date: 198X
Type: Cassette
Platform(s): TS 1000
Tags: Business

This listing contains two independent business finance programs. The first performs break-even analysis, prompting the user for fixed costs, variable parts cost per unit, selling price, starting and finishing stock quantities, and an increment step, then printing a columnar cost/revenue/profit-loss schedule with a clearly marked break-even row; it supports optional hard-copy output via LPRINT. The second program is a job quote estimator that collects materials, shop labour, and on-site labour costs (each optionally itemised line-by-line), then computes overhead and profit as user-supplied percentages and prints a formatted multi-column estimate summary, with a COPY command triggered by pressing Z to produce a printer dump. Both programs use SCROLL extensively to manage the ZX81’s 24-row display in SLOW mode, switch to FAST mode for computation-heavy sections, and round currency values using the INT(100*x+0.05)/100 idiom for two-decimal-place accuracy. The itemised entry subroutine at line 1200 is shared between the materials, shop labour, and on-site labour collection paths in the second program.


Program Analysis

The listing contains two completely independent programs separated by their own SAVE and RUN tail lines. The first (lines 10–9999) is a break-even analysis tool. The second (lines 10–9999, restarting) is a job quotation estimator. They are analysed separately below.

Program 1 – Break-Even Analysis: Structure

The program is entirely linear with no subroutines. It collects six inputs (fixed costs F, variable cost per unit V, selling price P, start quantity B, finish quantity C, and increment S), then iterates from B to C in steps of S, printing a cost/revenue table. At line 460–480 the break-even quantity D, break-even revenue G, and break-even cost H are calculated before the loop begins.

  1. Input phase (lines 70–410): six prompted INPUT statements, each followed by confirmation PRINT and SCROLL pairs.
  2. Hard-copy option (lines 432–457): asks for Y$; any line thereafter guarded by IF Y$(1)="Y" duplicates output to the printer via LPRINT.
  3. Computation and output loop (lines 530–1030): FOR N=B TO C STEP S; at line 580 a test IF N<D branches to 1000 (skipping the break-even banner), otherwise prints the separator, break-even row, and resets D=99999999 so the banner fires only once.
  4. Recycle (lines 2000–2060): waits for any keypress then RUNs from the top.

Program 1 – Notable Techniques and Idioms

  • FAST/SLOW switching: FAST at line 420 speeds up the CLS and setup; SLOW at line 510 restores display before the output loop so results are visible as they scroll.
  • One-shot break-even banner: after printing the break-even row (lines 590–640), D is set to 99999999 (line 650) so the condition at line 580 never triggers again within the same run.
  • Zero-start guard: line 520 prevents a division-by-zero in U=E/N when B=0 by advancing B to S.
  • Unit-cost rounding: line 565 applies INT(10*U+.5)/10 — rounding to one decimal place.
  • Busy-wait keypress: lines 2030–2040 use the INKEY$ polling loop, a standard ZX81 idiom.
  • LPRINT mirroring: every significant PRINT in the output phase has a corresponding IF Y$(1)="Y" THEN LPRINT guard, doubling the line count but keeping hard-copy output structurally identical to screen output.

Program 1 – Bugs and Anomalies

  • At line 9998 the filename contains an inverse N mid-word, which is the auto-run marker embedded in the filename string.
  • The LPRINT column footer at line 1060 contains leading spaces rather than using TAB, so alignment may drift slightly depending on printer character width.
  • If P=V (selling price equals variable cost), line 460 will cause a division-by-zero error as there is no guard.

Program 2 – Job Quote Estimator: Structure

This program uses a counter D (line 20, incremented at line 205) to number successive estimates within a session. Three subroutine groups handle data collection and output:

Line rangePurpose
1000–1190Material cost collection: dispatch to itemised (1200) or total-entry path
1200–1670Generic line-item entry loop (shared by materials, shop labour, on-site labour)
2000–2550Labour cost collection: shop labour then on-site labour, each optionally itemised
3000–3290Quote summary display and optional COPY dump

Program 2 – The Shared Itemisation Subroutine (line 1200)

Subroutine 1200 is called three times: for materials (line 1150), shop labour (line 2115), and on-site labour (line 2340). It accumulates a running total in C, collecting item name B$, unit cost A, and quantity G in a loop. An empty B$ input (line 1255) terminates entry and returns the total in C. The caller then copies C into the appropriate variable (M, L, or H).

Program 2 – Financial Calculations

All monetary arithmetic is done in floating point and then rounded. The main formula chain (lines 550–640):

  • B = Q*M — total material cost (units × per-unit material)
  • K = Q*L — total shop labour
  • J = H*Q — total on-site labour
  • V = O*(L+H) — overhead per unit (percentage of direct labour only)
  • W = V*Q — total overhead
  • R = P*(B+K+J+W) — total profit (percentage of total job cost excluding profit itself)
  • S = B+K+J+R+W — total quote
  • T = S/Q, X = R/Q — per-unit equivalents

Note that overhead is calculated on direct labour only (L+H), not on materials, which is a deliberate business convention reflected in line 590.

Program 2 – Currency Rounding Idiom

Throughout the summary subroutine (lines 3102–3256), values are rounded to two decimal places using INT(100*x+.05)/100. The bias of 0.05 (rather than the standard 0.5 used in program 1’s line 565) is slightly too small — correct two-decimal rounding requires +0.005 — so values near half-penny boundaries may round down incorrectly. The same pattern appears in the itemisation loop at line 1455.

Program 2 – COPY Dump Mechanism

The summary subroutine ends with a PAUSE 40000 (line 3270) giving the user approximately 40 seconds to press Z. Line 3280 tests INKEY$="Z" immediately after the pause expires or the user presses a key; if Z was the key that broke the pause, COPY is executed to dump the screen to a printer. This is a common ZX81 screen-print idiom since COPY sends the full display bitmap to the printer port.

Program 2 – Anomalies

  • Line 2130 uses GOTO 2240 rather than RETURN after setting L=C, skipping the corresponding RETURN at line 2230 (which does not exist). This means execution falls through to line 2240 correctly but is structurally fragile.
  • “INSTALATIONS” is misspelled at line 3080 (missing one L), as it is at line 300 in the input phase.
  • Variable C is overloaded: it holds the overhead percentage input at line 410 and is also the running item total inside subroutine 1200. The overhead percentage is safely converted to O=C/100 at line 430 before any subroutine call, so there is no collision in practice, but the summary at line 3200 prints C as the overhead percentage label — which by that point still holds the last value from the itemisation loop, not the original percentage. This is a latent display bug.
  • The GOTO 100 at line 690 re-enters the main loop but does not reinitialise D, so the estimate counter correctly increments across quotes in a session.

Content

Appears On

Related Products

Job Quote: versatile estimating program. Break Even: production analysis.

Related Articles

Related Content

Image Gallery

Business #4

Source Code

  10 PRINT AT 10,6;"BREAK-EVEN  ANALYSIS"
  20 PRINT ,,"PRODUCES COSTS/REVENUE SCHEDULES"
  30 PAUSE 200
  40 FOR N=1 TO 6
  50 SCROLL 
  60 NEXT N
  70 PRINT "WHAT ARE THE FIXED COSTS?"
  80 INPUT F
  90 SCROLL 
 100 PRINT ,F
 110 SCROLL 
 120 SCROLL 
 130 PRINT "WHAT IS THE PARTS COST PER UNIT?"
 140 INPUT V
 150 SCROLL 
 160 PRINT ,V
 170 SCROLL 
 180 SCROLL 
 190 PRINT "WHAT IS THE UNIT SELLING COST?"
 200 INPUT P
 210 SCROLL 
 220 PRINT ,P
 230 SCROLL 
 240 SCROLL 
 250 PRINT "UNITS IN STOCK AT START?"
 260 INPUT B
 270 SCROLL 
 280 PRINT ,B
 290 SCROLL 
 300 SCROLL 
 310 PRINT "UNITS IN STOCK AT FINISH?"
 320 INPUT C
 330 SCROLL 
 340 PRINT ,C
 350 SCROLL 
 360 SCROLL 
 370 PRINT "ANALYSIS INCREMENT NUMBER?"
 380 INPUT S
 390 SCROLL 
 400 PRINT ,S
 410 PAUSE 200
 420 FAST 
 430 CLS 
 432 PRINT ,,"DO YOU WANT HARD COPY?"
 434 INPUT Y$
 440 SCROLL 
 450 PRINT "QUANT COST  REV   P/L   UN COST"
 455 IF Y$(1)="Y" THEN LPRINT "QUANT COST  REV   P/L   UN COST"
 457 IF Y$(1)="Y" THEN LPRINT 
 460 LET D=F/(P-V)
 470 LET G=P*D
 480 LET H=F+V*D
 490 SCROLL 
 500 SCROLL 
 510 SLOW 
 520 IF B=0 THEN LET B=B+S
 530 FOR N=B TO C STEP S
 540 LET R=P*N
 550 LET E=F+V*N
 560 LET U=E/N
 565 LET U=INT (10*U+.5)/10
 570 LET A=R-E
 580 IF N<D THEN GOTO 1000
 590 PRINT "--------------------------------"
 595 IF Y$(1)="Y" THEN LPRINT "--------------------------------"
 600 SCROLL 
 610 PRINT INT D;TAB 6;INT H;TAB 12;INT G;TAB 18;"BREAK-EVEN"
 613 SCROLL 
 615 IF Y$(1)="Y" THEN LPRINT INT D;TAB 6;INT H;TAB 12;INT G;TAB 18;"BREAK-EVEN"
 620 SCROLL 
 630 PRINT "--------------------------------"
 635 IF Y$(1)="Y" THEN LPRINT "--------------------------------"
 640 SCROLL 
 650 LET D=99999999
 1000 PRINT N;TAB 6;E;TAB 12;R;TAB 18;A;TAB 24;U
 1003 SCROLL 
 1005 IF Y$(1)="Y" THEN LPRINT N;TAB 6;E;TAB 12;R;TAB 18;A;TAB 24;U
 1010 SCROLL 
 1020 SCROLL 
 1030 NEXT N
 1040 SCROLL 
 1050 SCROLL 
 1060 IF Y$(1)="Y" THEN LPRINT "                                QUANT COST  REV   P/L   UN COST"
 2000 SCROLL 
 2010 SCROLL 
 2020 PRINT "PRESS ENTER TO RECYCLE :::"
 2030 LET Y$=INKEY$
 2040 IF Y$="" THEN GOTO 2040
 2050 CLS 
 2060 RUN 
 9998 SAVE "BREAK EVE%N"
 9999 RUN 
 
  10 CLS 
  20 LET D=0
 100 CLS 
 110 PRINT AT 12,0;" %*%*%*% %J%O%B% %Q%U%O%T%E% %E%S%T%I%M%A%T%E%R% %*%*%*"
 200 SCROLL 
 205 LET D=D+1
 210 PRINT "   PRESS ENTER TO START :::"
 220 INPUT Y$
 230 CLS 
 240 SCROLL 
 250 PRINT "JOB NAME?  ";
 260 INPUT N$
 270 PRINT N$
 280 SCROLL 
 290 SCROLL 
 300 PRINT "NUMBER OF INSTALLATIONS?"
 310 SCROLL 
 320 INPUT Q
 330 PRINT ,Q
 340 SCROLL 
 350 SCROLL 
 360 GOSUB 1000
 370 GOSUB 2000
 380 SCROLL 
 390 PRINT "OVERHEAD (PER. OF DIRECT LABOR)?"
 400 SCROLL 
 410 INPUT C
 420 SCROLL 
 425 PRINT ,C
 426 SCROLL 
 430 LET O=C/100
 440 SCROLL 
 450 PRINT "PROFIT (PER OF JOB COST)?"
 460 SCROLL 
 470 INPUT Z
 480 PRINT ,Z
 490 SCROLL 
 500 SCROLL 
 510 LET P=Z/100
 520 PRINT "PRESS ENTER TO SEE QUOTE :::"
 530 INPUT Y$
 540 CLS 
 550 LET B=Q*M
 560 LET K=Q*L
 570 LET J=H*Q
 590 LET V=O*(L+H)
 600 LET W=V*Q
 610 LET R=P*(B+K+J+W)
 620 LET X=R/Q
 630 LET S=B+K+J+R+W
 640 LET T=S/Q
 650 GOSUB 3000
 660 SCROLL 
 665 SCROLL 
 670 PRINT "PRESS ENTER FOR ANOTHER QUOTE ::"
 680 INPUT Y$
 690 GOTO 100
 1000 PRINT "ARE MATERIAL COSTS TO BE"
 1010 SCROLL 
 1020 PRINT "ITEMIZED (Y/N)?"
 1030 SCROLL 
 1040 INPUT B$
 1050 IF B$(1)="Y" THEN GOTO 1100
 1060 IF B$(1)="N" THEN GOTO 1160
 1070 GOTO 1040
 1100 SCROLL 
 1110 SCROLL 
 1120 PRINT "MATERIAL COSTS :::"
 1130 SCROLL 
 1140 SCROLL 
 1150 GOSUB 1200
 1155 LET M=C
 1156 RETURN 
 1160 SCROLL 
 1170 SCROLL 
 1180 PRINT "TOTAL MATERIAL COST?  ";
 1184 INPUT M
 1186 PRINT M
 1188 SCROLL 
 1190 RETURN 
 1200 LET C=0
 1205 SCROLL 
 1210 PRINT "ESTIMATE NO.";D
 1220 SCROLL 
 1230 SCROLL 
 1240 PRINT "ITEM?",
 1250 INPUT B$
 1255 IF B$="" THEN GOTO 1600
 1260 PRINT B$
 1270 SCROLL 
 1280 SCROLL 
 1290 PRINT "COST?",
 1300 INPUT A
 1310 PRINT A
 1320 SCROLL 
 1340 SCROLL 
 1350 PRINT "QUANTITY?",
 1360 INPUT G
 1370 PRINT G
 1380 LET E=A*G
 1390 SCROLL 
 1400 SCROLL 
 1410 SCROLL 
 1430 PRINT "ITEM    COST    QUANT   EXTEND"
 1440 SCROLL 
 1450 SCROLL 
 1455 LET E=INT (100*E+.05)/100
 1460 PRINT B$;TAB 8;A;TAB 16;G;TAB 24;E
 1470 SCROLL 
 1480 SCROLL 
 1490 LET C=C+E
 1500 GOTO 1220
 1600 SCROLL 
 1605 SCROLL 
 1610 PRINT "TOTAL",C
 1620 SCROLL 
 1630 SCROLL 
 1640 PRINT "PRESS ENTER TO CONTINUE :::"
 1650 INPUT B$
 1660 CLS 
 1670 RETURN 
 2000 SCROLL 
 2010 SCROLL 
 2020 PRINT "DO YOU WANT SHOP LABOR ITEMIZED?"
 2030 INPUT Y$
 2040 IF Y$(1)="N" THEN GOTO 2140
 2050 IF Y$(1)="Y" THEN GOTO 2070
 2060 GOTO 2030
 2070 SCROLL 
 2080 SCROLL 
 2090 PRINT "SHOP LABOR PER HOUR"
 2100 SCROLL 
 2110 SCROLL 
 2115 GOSUB 1200
 2120 LET L=C
 2130 GOTO 2240
 2140 SCROLL 
 2150 SCROLL 
 2160 PRINT "COST FOR TOTAL SHOP LABOR?"
 2170 SCROLL 
 2180 SCROLL 
 2190 INPUT L
 2200 PRINT ,L
 2210 SCROLL 
 2240 SCROLL 
 2260 PRINT "ON SITE LABOR TO BE ITEMIZED?"
 2270 SCROLL 
 2280 INPUT B$
 2290 IF B$(1)="Y" THEN GOTO 2320
 2300 IF B$(1)="N" THEN GOTO 2500
 2310 GOTO 2280
 2320 CLS 
 2330 PRINT ,,"ON SITE LABOR PER HOUR :::"
 2340 GOSUB 1200
 2350 LET H=C
 2360 RETURN 
 2500 SCROLL 
 2510 SCROLL 
 2520 PRINT "ON SITE LABOR TOTAL COST?"
 2530 INPUT H
 2540 SCROLL 
 2550 RETURN 
 3000 SCROLL 
 3010 SCROLL 
 3020 PRINT "NAME   ";N$;TAB 16;"ESTIMATE ";D
 3030 SCROLL 
 3040 SCROLL 
 3050 PRINT "EST PAR    NO. UNITS    EXTENDED"
 3060 SCROLL 
 3070 SCROLL 
 3080 PRINT "NUMBER OF INSTALATIONS   ";Q
 3090 SCROLL 
 3100 SCROLL 
 3102 LET M=INT (100*M+.05)/100
 3104 LET B=INT (100*B+.05)/100
 3110 PRINT "MATERIAL COST ";M;TAB 25;B
 3120 SCROLL 
 3130 SCROLL 
 3132 LET L=INT (100*L+.05)/100
 3134 LET K=INT (100*K+.05)/100
 3140 PRINT "SHOP LAB COST ";L;TAB 25;K
 3150 SCROLL 
 3160 SCROLL 
 3162 LET H=INT (100*H+.05)/100
 3164 LET J=INT (100*J+.05)/100
 3170 PRINT "SITE LAB COST ";H;TAB 25;J
 3180 SCROLL 
 3190 SCROLL 
 3195 LET W=INT (100*W+.05)/100
 3196 LET V=INT (100*V+.05)/100
 3200 PRINT "OVRHD";" (";C;")";TAB 14;V;TAB 25;W
 3210 SCROLL 
 3220 SCROLL 
 3225 LET R=INT (100*R+.05)/100
 3226 LET X=INT (100*X+.05)/100
 3230 PRINT "PROFIT";" (";Z;")";TAB 14;X;TAB 25;R
 3240 SCROLL 
 3250 SCROLL 
 3255 LET S=INT (100*S+.05)/100
 3256 LET T=INT (100*T+.05)/100
 3260 PRINT "JOB QUOTE";TAB 14;T;TAB 25;S
 3262 SCROLL 
 3263 SCROLL 
 3265 PRINT AT 21,0;"PRESS <Z> FOR COPY ::"
 3270 PAUSE 40000
 3275 PRINT AT 21,0;"                     "
 3280 IF INKEY$="Z" THEN COPY 
 3290 RETURN 
 9998 SAVE "QUOT%E"
 9999 RUN 

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

People

No people associated with this content.

Scroll to Top