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...
"
A line
is
terminated only when you press
(ENTER)
and not
at
the end
of
a display line.
List the program
to
confirm that it
is:
10
INPUT
"AMOUNT
OF
SALES";
ST
20
IF
ST
<=
2000
THEN
CM
=
.15
*
ST
ELSE
CM
=
.20
*
ST
40
PRINT
"COMMISSION
IS";
45
A$
=
"**$###,###.##"
50
PRINTUSING
A$
;
CM
Execute the program.
When prompted for the amount
of
sales, enter 1000. The commission will be
computed as
$150.00, which is a straight 15%.
Run the program again and enter a sales
of
3000. This time the commission will be
computed
as
$600.00 which is a straight 20%.
The IF/THEN/ELSE statement is used to execute one
of
two different statements
depending upon the logical value
of
the condition.
If
sales are less than or equal
to
2000, the commission
is
calculated as
15%
of
sales
and control passes
to
line 40. However,
if
sales are over 2000, then the statement
following ELSE is executed instead, so that the commission is calculated as 20% of
sales and again control passes
to
line 40.
The general format of the IF/THEN/ELSE statement
is:
IF
"condition" THEN "statement
]"
ELSE "statement
2"
"statement
]"
is executedjf "condition"
is
true, but "statement
2"
is executed
if
"condition" is false
In either case, control passes
to
the next line in the program. The statements executed
can be any valid BASIC statements. Here are some more valid examples
of
the
IFITHEN/ELSE statement:
100 IF A = 0 THEN A = B + 1 ELSE A =
B-1
200 IF A + B < 100 THEN A = B ELSE A = 0
Experiment
#6
Computing Commissions for
Several Salesmen
The Commission Sales program,
as
it currently exists, will compute the commission
for one salesman and terminate. To compute the commissions for several salesmen, it
must be modified.
List the program
to
confirm that it still looks like this:
10
INPUT
"AMOUNT
OF
SALES";
ST
20
IF
ST
<=
2000
THEN
CM
=
.15
*
ST
ELSE
CM
=
.20
*
ST
40 PRINT
"COMMISSION
IS";
45
A$
=
H**$###,###.##"
50
PRINTUSING
A$
;
CM
52

Other manuals for Radio Shack TRS-80 Model 100

Related product manuals