Radio Shack TRS-80 Model 100 Basic Manual page 48

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

Advertisement

Line
40
allows the length of the loan (in years) to be entered and stored in variable T.
Line 50 computes the number of payment periods (months) of the loan and stores the
value in variable N.
Line 60 computes the interest rate per month and stores it in variable
1.
Lines 70 • 80 compute the monthly payment. The computation was done in two lines
rather than one, to avoid having a long, complicated expression in a single line.
Recall that the equals symbol
(=)
means to assign the value computed on the right
side to the variable on the left side. In line 80 the value of
AlMP
is computed and
then stored in MP.
Line 90 prints the amount of the monthly payment.
Run the program several times with your own data. Have you ever wondered what
effect a change in the" interest rate would have on your mortgage payment? Just run
the program and vary the interest rate while keeping the other variables constant.
Experiment #9 Calculation of Total Amount and
Loan Balance
In addition to calculating the monthly mortgage payment, as in the last experiment,
you might wish to compute the total amount you have to pay. This is done by
multiplying the number of pay periods N by the monthly payment MP. Type in lines
100 and 110 as follows:
100 TA
=
N
*
MP
110
PRINT "TOTAL AMOUNT PAID IS
$";
TA
Another calculation that can be made is the determination of the loan balance or
outstanding principal, after a certain number of payments. Enter the following lines:
120 INPUT "CURRENT YEAR OF LOAN"; Y
130
M
=
12
*
Y
140 B
=
(1 - (1
+
l)h(M-N» / I
150 B
=
MP
*
B
160 PRINT "PRINCIPAL REMAINING IS
$";
B
Here is a listing of the the complete program:
10
INPUT "INTEREST RATE ( 0
-
100) " ; R
20
R
=
R
/
100
30
INPUT "AMOUNT OF LOAN"; A
40
INPUT"NUMBER OF YEARS"; T
50
N
=
12
*
T
60
I
=
R
/
12
70
MP
=
( 1
-
( 1
+
I)h(_N))
/
I
80
MP
=
A
/
MP
80
PRINT "MONTHLY PAYMENT IS
$" ;
MP
100 TA
=
N
*
MP
110 PRINT "TOTAL AMOUNT PAID IS
$";
TA
120 INPUT "CURRENT YEAR OF LOAN"; Y
130 M
=
12
*
Y
42

Advertisement

Table of Contents
loading

Table of Contents