Radio Shack TRS-80 Model 100 Basic Manual page 208

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

Advertisement

Lines 169 - 219 The data file is opened for input. The data is read one value at a time
from the input file until an end of file is encountered (Line 189). When the last data
value is read, the input file is closed. The number of data values is incremented and
stored in the numeric variable N.
Lines 229 - 345 The user is asked whether to output the data values or not.
If
not,
execution jumps to Line 350. If output is desired, the user is asked to specify whether
the LCD, the Printer or Both should be used. If the LCD only is desired, only the
PRINT statement is executed.
If
the Printer only is desired, only the LPRINT
statement is executed. If both the LCD and the Printer are desired, then both the
PRINT and the LPRINT statements are executed.
A FOR/NEXT loop increments through all N data values.
Lines 359 • 499 A bubble sort is used to put the data values into ascending order.
This is necessary in order to compute the median.
Lines 419 - 548 This section is similar to Lines 220 - 340, except that the sorted data
values will be output if desired.
Lines 558 - 668 The mean, variance, standard deviation and median are calculated
and stored respectively in the variables M, Y, SD, MD.
Lines 678 • 738 The results are output to the display using PRINT statements. The
user is asked if output is also desired to the printer.
If it
is, the results are output a
second time using LPRINT statements.
Lines 749 - 939 The user is asked if a histogram is desired.
If
not, execution ends. If
a histogram is desired, it is necessary to input the number of classes, NC, and then to
calculate the class length, CL. A FOR/NEXT loop (Lines 830 - 880) increments
through all data values and counts the frequency of occurrence in each class. The
frequencies are stored in the F array.
A FOR/NEXT loop (Lines 910 - 930) is used to compute the maximum frequency and
stores it in MF. The maximum frequency is required in order to scale the histogram
display.
Lines 949 - 989 The user is asked whether to output the histogram to the LCD, to the
Printer or to both.
Lines 1888· 1Ut8 This section of the program displays the histogram on the LCD.
Since the display area is limited, no labels are used on the axes. The LINE statement
is used to draw the axes.
A FOR/NEXT loop (Lines 1050 - 1090) is used to draw a box for each class, where
the height of the box represents the frequency of that class.
Lines 1118 • 1228 The histogram is output to the printer. Since there is no LINE
statement for use with the printer, the histogram must be printed one line at a time
using standard ASCII characters. The asterisk, "*", was picked somewhat arbitrarily
as the fill character because of its relative density.
A FOR/NEXT loop (Lines 1130 - 1190) prints the "boxes". The vertical axis is
printed in line 1140. The horizontal axis is printed in line 1200. A FOR/NEXT loop
(Lines 1210 - 1220) is used to print the horizontal axis labels.
Lines 1238 • 1288 A table consisting of the class intervals and the corresponding
frequencies is printed.
202

Advertisement

Table of Contents
loading

Table of Contents