One of the most useful capabilities of a computer is its ability to calculate many cases for a business or technical problem and display the results for you to analyze. This is one kind of computer model.
Let’s take a simple case and work it through to see how you construct a model of your own. For our example, we will calculate the profit for various quantities of a product.
Overall, we need to calculate the revenue from sales and the cost of goods sold. Total revenue (TREV) equals sales price for each unit (USP) times number of units sold (USLS). Total cost is the sum of initial fixed costs (IFXCOST) and variable cost per unit (UVCOST) times number of units sold. Thus we can write:
1000 LET TREV=USP*USLS
2000 LET VARCOST=UVCOST*USLS
2500 LET TCOST=VARCOST+IFXCOST
3000 LET PROFIT=TREV-TCOST
5000 PRINT PROFIT
Equations define the relationships among the variables, but the model program cannot run because costs and prices are not yet assigned. Now we must specify these values:
50 LET USLS=1000
100 LET USP=12
200 LET UVCOST=2
210 LET IFXCOST=4000
Now you can run the program and see the answer. Big deal, this you could do with any cheap four-banger. But your ZX80 can automate the process for you. Here’s how.
Delete line 50 and add a FOR-NEXT loop at line 900. We will find the profit for unit sales from 200 to 1000 pieces in 100-unit increments. Insert the NEXT statement after the PRINT statement to see all the values:
900 FOR I=2 TO 10
920 LET USLS=100*I
5900 NEXT I
From here forward, you can run the program and see the developing result after each block of instructions. Try it.
Change the PRINT statement so you can see the unit sales and the profit for each:
5000 PRINT USLS,PROFIT
For convenience, display the values of prices and costs. Put the statement before the loop so it prints only once. For better appearance, use an empty PRINT line to get a space:
790 PRINT
800 PRINT "UNIT SALES PRICE ";USP
810 PRINT "UNIT VARIABLE COST ";UVCOST
820 PRINT "FIXED COSTS ";IFXCOST
Now the screen displays all the data we put in as well as the results as sales vary. We are using computer capability.
Let’s further suppose that producing more than 800 units needs more space, so we suffer an increase of fixed expense of UPFX. Implement this by adding:
220 LET UPFX=1000
2100 LET FXCOST=IFXCOST
2400 IF USLS>800 THEN LET FXCOST=FXCOST+UPFX
and modify line 820 to:
820 PRINT "FIXED COSTS ";IFXCOST;",";IFXCOST+UPFX
So far, we’ve just varied the number of units sold, so let’s now change the sales price at the same time. Since sales price will now vary, we need to change line 800. We want to try three sales prices, say 10, 12 and 14; we’ll need to add another loop. Delete lines 100 and 800:
75 DIM A(3)
85 LET A(1)=10
86 LET A(2)=12
87 LET A(3)=14
940 PRINT USLS,
950 FOR J=1 TO 3
960 LET USP=A(J)
5000 PRINT PROFIT,
5100 NEXT J
Now we need labels atop the table:
840 PRINT
850 PRINT "UNIT",,"PROFIT"
860 PRINT "SALES","USP=";A(1),A(2),A(3)
870 PRINT
Lines 1000 to 3000 express standard relations for break-even analysis of any business. All the remaining model parts fix values, vary conditions, or tabulate and display results. You can alter this program by changing values, by changing relationships, by making costs or revenue depend on sales in more complex ways, or by changing the output to provide another data summary.
Apply these principles to any model situation that helps you make personal or business choices.
RAM addresses start at 16384 and end at 17408 for the 1K machine.
ATTENTION M.L. PROGRAMMERS:
In conjunction with our upcoming series on machine language programming, we need machine language program listings. Please subnit original programs or translations of our proviously published listings. We will pay our usual rates for listings and accompanying explanatory text. Become famous!
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.