home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Between Heaven & Hell 2
/
BetweenHeavenHell.cdr
/
100
/
57
/
mngmonry.arc
/
PAYBACK.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-07-19
|
986b
|
24 lines
100 'Payback Period ("PAYBACK")
110 CLS
120 COLOR 0,15 : PRINT "Payback Period" : COLOR 15,0
130 DEFDBL A-Z
140 PRINT:PRINT
150 PRINT "Do not enter dollar signs or commas"
160 PRINT
170 ' Let user enter data
180 INPUT "Initial investment: ", PV
190 INPUT "Return each period: ", PMT
200 INPUT "Number of returns per year: ", NPY
210 INPUT "Annual interest rate (in percent): ", AR
220 ' Convert annual interest rate to periodic one
230 PR = (1 + AR / 100) ^ (1 / NPY) - 1
240 ' Check if payback possible
250 IF PMT < PV * PR THEN PRINT " ** Error - No payback **" : END
260 ' Find payback period
270 NPERIODS = LOG (1 - PR * PV / PMT)
280 IF PR <> 0 THEN NPERIODS = -NPERIODS / (LOG (1 + PR) ) ELSE NPERIODS = PV / PMT
290 IF (NPERIODS - INT (NPERIODS) ) < .001 THEN NPERIODS = INT (NPERIODS) ELSE NPERIODS = INT(NPERIODS) + 1
300 PRINT
310 PRINT "Payback after "; NPERIODS; " periods"
320 END