Experiment
#7
·Personalizing the Output -
Printing a Name
The compound interest program
as
it currently exists
is:
10
INPUT
"PRINCIPAL, RATE";
P,
R
30
INPUT
"TIME,
NUMBER
OF
PERIODS";
T,
K
50
S = P *
(1
+ R /
Klh(T
*
Kl
60
PRINT
"TOTAL
IS
$";
S
70
PRINT
80
GoTo
10
Add line 40
as
follows:
£10
INPUT
"NAME";
N$
and change line 60
to
60
PRINT
"TOTAL
FOR
"
Add line
65
65
PRINT
N$;"
IS
$";
S
List the program
to
confirm it
is
1121
INPUT
"PRINCIPAL, RATE";
1',
R
3121
INPUT
"TIME,
NUMBER
OF
PERIODS";
T,
K
£10
INPUT
"NAME";
N$
50
S = P *
(1
+ R /
K)h(T
*
K)
60 PRINT
"TOTAL
FOR"
65
PRINT
N$;"
IS
$";
S
7121
PRINT
80
GoTo
1121
When you execute the program you will be prompted,
as
before, for the principal,
rate, time and number
of
periods. In addition, you will be prompted for a name. After
this data is entered, the name and the amount of the investment will
be
printed. Run
the program and enter the data
as
indicated below (of course, you may enter any other
name you wish):
PRINCIPAL,
RATE?
2000,
.13
TIME,
NUMBER
OF
PERIODS?
10,
2
NAME?
JANICE
SMITH
TOTAL
IS
$
17618.22531759
Execute the program several times with various numeric values and names. To
tenninate execution,
(BREAK)
must be pressed.
Lines
ut
. 38 allow you
to
enter values for the numeric variables in the program.
39