home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Between Heaven & Hell 2
/
BetweenHeavenHell.cdr
/
100
/
57
/
mngmonry.arc
/
PERTERM.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-07-19
|
2KB
|
38 lines
100 'Periodic Term ("PERTERM")
110 CLS
120 COLOR 0,15 : PRINT "Periodic Term" : COLOR 15,0
130 DEFDBL A-Z
140 DEFINT M-N
150 ' Let user enter data
160 PRINT : PRINT "Do not enter dollars signs or commas"
170 PRINT
180 INPUT "Savings goal: ", FV
190 INPUT "Annual interest rate (in percent): ", AR
200 INPUT "Deposit each period: ", DEPOSIT
210 INPUT "Number of deposits per year: ", NPY
220 INPUT "Annual inflation rate (in percent): ", INFLATION
230 INPUT "Marginal tax rate (in percent): ", TAXRATE
240 ' Determine after-tax, periodic interest rate
250 PR = (1 + AR / 100) ^ (1 / NPY) - 1
260 PR = PR * (1 - TAXRATE / 100)
270 ' Term to reach nominal goal
280 TPERIODS = LOG (FV / DEPOSIT * PR + 1 + PR)
290 IF PR <> 0 THEN NPERIODS = -1 + TPERIODS / LOG (1 + PR) ELSE NPERIODS = FV / DEPOSIT
300 PRINT
310 PRINT "Number of periods to reach nominal goal: "; NPERIODS
320 ' Term to reach inflation adjusted goal
330 INFLATION = (1 + INFLATION / 100) ^ (1 / NPY) 'Periodic inflation factor
340 CURRENTBAL = 0
350 PREVBAL = 0
360 NPERIODS = 0
370 INFV = FV
380 WHILE CURRENTBAL < INFV
390 NPERIODS = NPERIODS + 1
400 INFV = INFV * INFLATION
410 CURRENTBAL = (PREVBAL + DEPOSIT) * (1 + PR)
420 IF NPERIODS > 1 THEN IF (CURRENTBAL / PREVBAL < INFLATION) THEN PRINT "Inflated goal never met" : END
430 PREVBAL = CURRENTBAL
440 WEND
450 PRINT "Number of periods to reach inflation-adjusted goal: "; NPERIODS
460 END