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