home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
xbase
/
library
/
dbase
/
compound
/
periods.prg
< prev
next >
Wrap
Text File
|
1979-12-31
|
2KB
|
66 lines
* PROGRAM --- PERIODS.PRG
* COMPOUND INTEREST: NUMBER OF TIME PERIODS
* AUTHOR: VENKAT PENUGONDE, IRVICE MICRO ARTS, IRVINE, CA
*
* MODIFIED TO RUN WITH WITH DBASE II
* THIS PROGRAM CALCULATES THE NUMBER OF TIME PERIODS IN A
* COMPOUND INTEREST CALCULATION GIVE THE FOLLOWING:
* PRINCIPAL = PRESENT VALUE OR PRINCIPAL
* ANNRATE = NOMINAL ANNUAL INTEREST RATE IN %
* YPERIOD = NUMBER OF COMPOUNDIING PERIODS PER YEAR
* FUVALUE = VALUE AT THE END OF THE TOTAL TIME PERIOD
SET TALK OFF
IF FILE('DBASEOVR.COM')
ERASE
ELSE
CLEAR
ENDIF
STORE 0.00 TO FUVALUE,PRINCIPAL,ANNRATE
STORE 0 TO YPERIOD
@ 2,30 SAY 'COMPOUND INTEREST'
@ 3,30 SAY 'NUMBER OF PERIODS'
@ 5,17 SAY 'PRINCIPAL [enter zero to exit] :'
@ 7,17 SAY 'FUTURE VALUE :'
@ 9,17 SAY 'ANNUAL INTEREST RATE [ in % ] :'
@ 11,17 SAY 'NUMBER OF COMPOUNDING PERIODS :'
STORE 'T' TO MCONTINUE
DO WHILE MCONTINUE = 'T'
@ 5,55 GET PRINCIPAL
READ
IF PRINCIPAL <= 0
STORE 'F' TO MCONTINUE
LOOP
ENDIF
@ 7,55 GET FUVALUE
@ 9,55 GET ANNRATE
@ 11,55 GET YPERIOD
READ
* COMPUTE INTEREST RATE PER PERIOD
STORE ANNRATE/YPERIOD TO INTRATE
*
* COMPUTE TOTAL NUMBER OF COMPOUNDING PERIODS
IF FILE('DBASEOVR.COM')
STORE FUVALUE/PRINCIPAL TO NUMBER
DO LOG
STORE MLOG TO NUMERATOR
STORE 1 + INTRATE/100 TO NUMBER
DO LOG
STORE MLOG TO DENOMANATO
ELSE
NUMERATOR = LOG(FUVALUE/PRINCIPAL)
DENOMANATO = LOG(1+INTRATE/100)
ENDIF
STORE NUMERATOR / DENOMANATO TO TPERIOD
@ 15,17 SAY 'NUMBER OF COMPOUNDING PERIODS ' + STR(TPERIOD,10,1)
ENDDO
RETURN