home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Between Heaven & Hell 2
/
BetweenHeavenHell.cdr
/
100
/
57
/
mngmonry.arc
/
INTRATE.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-07-19
|
855b
|
27 lines
100 ' Interest Rate on Loan ("INTRATE")
110 CLS
120 COLOR 0,15 : PRINT "Interest Rate on Loan" : COLOR 15,0
130 PRINT : PRINT
140 DEFDBL A-Z
150 DEFINT M-N
160 ' Let user enter the data
170 PRINT "Do not enter dollar signs or commas"
180 PRINT
190 INPUT "Amount of loan: ", PNCPL
200 INPUT "Monthly payment: ", PMT
210 INPUT "Term (in months): ", NMONTHS
220 ' Use bisection method to find interest rate
230 RLOWER = 0 'Initial values
240 RUPPER= .5
250 WHILE (RUPPER - RLOWER) > .00001
260 PR = (RLOWER + RUPPER) / 2
270 'Calculate payment for trial value
280 TRIALPMT = PNCPL / ( (1 - (1 + PR) ^ -NMONTHS) / PR)
290 IF TRIALPMT > PMT THEN RUPPER = PR ELSE RLOWER = PR
300 WEND
310 ' Print results
320 AR = (RUPPER + RLOWER) / 2 * 1200
330 PRINT
340 PRINT "Interest rate: "; USING "###.##_%"; AR
350 END