This program performs break-even analysis, a financial calculation tool that computes either required sales volume to achieve a target profit or the net profit from an estimated sales figure. The user first chooses a mode: entering “S” calculates the sales needed for a desired profit (either as a fixed dollar amount or as a decimal percentage of sales), while entering “P” calculates net profit from an estimated sales figure using the formula E = Sales − (Sales × Variable Cost Rate) − Fixed Costs. Line 120 uses the contribution margin formula S = (N + F) / (1 − V) for fixed profit targets, while line 130 handles percentage-profit targets as S = F / (1 − V − N). After displaying results the program loops back to line 9, allowing repeated calculations without re-entering cost parameters.
Program Analysis
Program Structure
The program is organized into three logical branches controlled by the initial mode selection at line 80. After the header and mode prompt (lines 5–31), fixed cost and variable cost rate inputs are collected (lines 40–76) before branching. The three branches are:
- Desired net profit as a dollar amount (lines 90–127): entered when
A$="S"andN>=1 - Desired net profit as a decimal percentage of sales (lines 130–150): entered when
A$="S"andN<1 - Net profit from estimated sales (lines 160–211): entered when
A$="P", reached viaGOTO 160at line 80
All branches converge at line 220, which offers the user a repeat loop back to line 9 (skipping re-entry of A$, F, and V — a likely unintentional design choice, since those values are reused rather than re-prompted).
Financial Formulae
| Line(s) | Formula | Use Case |
|---|---|---|
| 120 | S = INT((N + F) / (1.00 − V)) | Sales required for fixed-dollar profit target |
| 130 | S = F / (1.00 − V − N) | Sales required when profit target is a decimal fraction of sales |
| 190–200 | E = INT(L − (L * V) − F) | Net profit from estimated sales L |
Line 120 applies INT() to truncate to a whole dollar figure, whereas line 130 does not — a minor inconsistency. The formula at line 130 correctly solves for sales when profit is a required proportion: S − S·V − F = N·S, rearranged to S = F / (1 − V − N).
Key BASIC Idioms
- Echo-printing inputs: Each
INPUTstatement is immediately followed by aPRINTof the variable (e.g., lines 51, 76, 101, 171). On the ZX81/TS1000,INPUTclears the display after entry, so echoing confirms to the user what was entered. - Mode selection via string comparison:
A$="P"at line 80 routes to the profit-estimation branch; the sales-target branch falls through by default, meaning any input other than"P"(including invalid entries) will proceed as if"S"was entered. - Percentage display: Line 140 multiplies
Nby 100 and appends"PCT."to display the decimal as a percentage for readability.
Bugs and Anomalies
- Repeat loop skips mode re-selection: The loop at line 260 returns to line 9 (a blank
PRINT), not to line 8 or 10. This means mode, fixed costs, and variable cost rate are all retained from the previous run. While occasionally useful, this prevents changing analysis mode without restarting. - Line 215 does not exist: Both lines 127 and 150
GOTO 215, but line 215 is absent; execution falls through to line 220 naturally. This is a harmless artifact — the next line after any non-existent target in sequence is executed — but it is unconventional. - No input validation: If the user enters a variable cost rate
V >= 1(orV >= 1 − Nin branch 2), a division by zero or negative sales result will occur without any error trap. - REM label typo: Line 5 reads
BEANAL(BREAK EVEN ANALYSIS— the opening parenthesis is unmatched, suggesting a truncated label.
Content
Source Code
5 REM BEANAL(BREAK EVEN ANALYSIS
8 PRINT "BREAK EVEN ANALYSIS"
9 PRINT
10 PRINT "DESIRE SALES OR NET PROFIT?ENTER S OR P"
30 INPUT A$
31 PRINT A$
40 PRINT "ENTER FIXED COSTS"
50 INPUT F
51 PRINT F
60 PRINT "VARIBLE COST RATE?ENTER AS A DECIMAL IN RELATION TO SALES"
75 INPUT V
76 PRINT V
80 IF A$="P" THEN GOTO 160
90 PRINT "DESIRED NET PROFIT? ENTER $ AMT OR DECIMAL PORTION OF SALES"
100 INPUT N
101 PRINT N
110 IF N<1 THEN GOTO 130
120 LET S=INT ((N+F)/(1.00-V))
122 PRINT
124 PRINT "FOR A NET PROFIT OF ";N;"THERE MUST BE ";S;"IN SALES"
127 GOTO 215
130 LET S=(F/(1.00-V-N))
135 PRINT
140 PRINT "FOR A NET PROFIT OF ";N*100;"PCT. THERE MUST BE";S;" IN SALES"
150 GOTO 215
160 PRINT "ESTIMATED SALES"
170 INPUT L
171 PRINT L
190 LET E=L-(L*V)-F
200 LET E=INT (E)
205 PRINT
210 PRINT "WITH SALES OF ";L;" YOUR PROFIT WILL BE ";E
211 PRINT
220 PRINT "ANOTHER CALCULATION? ENTER Y OR N"
240 INPUT Z$
250 IF Z$="N" THEN GOTO 270
260 GOTO 9
270 STOP
280 SAVE "1011%4"
290 LIST
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
