228
Save the aplet and use the File - Aplet library facility to create the two special
files for the directory which allow the calculator to download it. Finally,
download it to the calculator and test it.
Choose the first option on the VIEWS menu to
plot the axes and then the ‘Explore’ option to
explore the equation of a line. On the pages
following we will examine the code in detail, as
it illustrates many highly important techniques.
Since it is the first program run we will look first at the program .LINEXPL.S.
The variable G is being used here as a flag. Before the ‘Explore’ option can
be used we must be sure that the axes have been plotted, and this will be
done by checking the value of G. Zero will mean ‘unready’ and one will mean
‘ready’. When the ‘Plot axes’ option is run the value of G will be set to 1 and
this will be checked before allowing the user to run the ‘Explore’ option. By
setting it to zero in the program which is run when the user presses
,
we ensure that the correct value is going to be in G initially. If this check is not
done then the code used in .LINEXPL.EX will cause the program to crash,
which is obviously not something we want. The axes are also set back to the
default settings in case the user has changed them.