Radio Shack TRS-80 Model 100 Basic Manual page 112

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

r ..
850 DATA 300, 330, 315, 380
2000 GOTO 2000
Run this program.
You should see the following display:
450
400
350
300
250
200
150
• •
.
0
4
8
12
16
20
24
28
You will have to press IBREAKJ to terminate execution of this program.
This graph depicts sales as a function of time, with the horizontal (X) axis
representing time in quarters of a year and the vertical (Y) axis representing sales
volume.
One advantage of displaying the data in graph form is that the pattern of sales is easier
to discern. In this case, for example, it is apparent that a long term upward trend in
sales exists. This was not so apparent from a tabular listing of the sales data.
Lines 58 - 748 The first part of the program remains unchanged which draws and
labels the axes.
Line 758 This begins a FOR/NEXT loop which reads the sales data from the Data
statements. There are six years of four quarters, so the total number of points will be
24.
Line 769 The PSET statement is used to tum on cells corresponding to each sales
point. The axes of the graph (where X=0 and Y
=
136) is at graphic cell (33,54).
Horizontally, the quarters are spaced six cells apart. The X coordinate of quarter one
is therefore computed as:
33
+
1*6,
=
39,
the second quarter as:
33
+
2*6
=
45,
and, in general, quarter X as;
The computation of the vertical coordinate is a little more complicated. One reason for
this is that graphic cell vertical coordinates increase from the top to the bottom of the
display, whereas the graph itself assumes that values increase from bottom to top. The
horizontal axis corresponds to a value of 136, which was carefully chosen so that the
labels line up with reasonable values (150, 200, etc.).
106

Advertisement

Table of Contents
loading

Table of Contents