EasyManua.ls Logo

Radio Shack TRS-80 Model 100

Radio Shack TRS-80 Model 100
210 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
and add lines 24, 26 and
28
24
IF
Nl$
<>
N$
THEN
GOTO
20
28
CM
=
ST
*
CR
28
RESTORE
Delete line 30.
Now the only remaining change
is
to add the table to the program. Type the following
line:
70
DATA
ADAMS,.15,JONES,.18,LEE,.18,SMITH,.20,
VINSON,.14
List the program
to
confirm that you have:
10
INPUT
"NAME,
SALES"; N$,
ST
15
IF
ST
< 0
THEN
STOP
20
READ
Nl$,
CR
24
IF
Nl$
<>
N$
THEN
GOTO
20
28
CM
=
CR
*
ST
28
RESTORE
40 PRINT
"COMMISSION
FOR
";
N$;"
IS
";
45
A$
=
"**$###,###.##"
50 PRINTUSING A$;
CM
80
GOTO
10
70
DATA
ADAMS,.15,JONES,.18,LEE,.18,SMITH,.20,
VINSON
t
.14
Run this program.
Be
sure to enter one of the five names listed
in
the table. The program will compute
and print the commission for that salesman. Continue to input names
in
any
order and
their corresponding sales totals. To end the program enter a dummy name and
negative value for the sales amount.
Line
20 reads the first name (ADAMS) listed in the DATA statement
in
line 70 and
places it in the string variable NI$.
It
reads the first commission rate (.15)
and
places
it in the variable CR.
Line 24 compares the name in N$, which was entered in line 10,
to
that in NI$.
If
they are different, the program jumps back to line 20 which then reads the next name
and commission rate
in
the DATA statement. The program continues looping in this
way until a match is found. When this happens,
CR
will contain the correct
commission rate for the salesman.
Line 26 computes the commission for the salesman.
Line 28
is
the
RESTORE
statement. When this statement
is
executed, the computer
will go back to the first item in the data list. Therefore the next time a READ
statement
is
executed,
it
will use the first item
in
the DATA list.
Without RESTORE, the reading of the
data would continue where it left off from the
time before.
If
the names are entered in an arbitrary order, the data list must be read
from
the beginning each time.
The remainder of the program is the same
as
before, with the exception of line 70.
Line 70 contains the DATA statement from which the names and rates are read. This
55

Other manuals for Radio Shack TRS-80 Model 100

Related product manuals