home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
d_b_a
/
86_11
/
la_prd.prg
< prev
next >
Wrap
Text File
|
1986-10-06
|
3KB
|
99 lines
* -- PROGRAM NAME: .......... LA_PRD.PRG
* -- PROGRAM TITLE: ......... Loan amortization, Number or Periods
* -- AUTHOR: ................ Venkat Penugonde
* Irvine Micro Arts, Irvine, CA
* -- SYSTEM ................ dBASE III or III +
* -- DATE FIRST CREATED .............. 08/21/86
* -- DATE MOST RECENTLY MODIFIED .....
*
* This program calculates the present value or principal of a laon
* amortized over a given period.
*
* Inputs required ......... 1) Principal Amount.
* 2) Equal Periodic Payment Amount.
* 3) Annual Interest Rate.
* 4) Number of Payment Periods per Year.
*
* Outputs Generated ....... 1) Present Value or Principal.
*
CLEAR
pok = 'N'
DO WHILE .t.
CLEAR
principal = 0.00
payment = 0.00
ann_rate = 0.000
y_period = 0
*
@ 2, 24 SAY ' * -- LOAN AMORTIZATION -- * '
@ 3, 24 SAY 'Computation of Number of Periods'
@ 6, 11 SAY 'Enter Principal [0 to exit] ...... ......... $'
@ 6, 58 GET principal PICTURE '99,999,999.99'
READ
IF principal <= 0
EXIT
ENDIF
@ 7, 11 SAY 'Enter periodic payment ..................... '
@ 7, 58 GET payment PICTURE '99,999,999.99'
@ 8, 11 SAY 'Enter annual interest rate [%] ............. '
@ 8, 66 GET ann_rate PICTURE '99.999'
@ 9, 11 SAY 'Enter Number of Payment Periods/Year ........ '
@ 9, 66 GET y_period PICTURE '99'
READ
IF payment <= 0 .OR. ann_rate <= 0 .OR. y_period <= 0
LOOP
ENDIF
* -- Calucualte interest rate per period
int_prd = ann_rate/(y_period * 100)
* -- Calculate number of periods
numerator = LOG(1 - (int_prd*principal/payment))
denomanator = LOG(1 + int_prd)
t_period = - numerator/denomanator
pok = 'Y'
@ 12, 11 SAY 'Output to Printer? [Y/N] ' GET pok PICTURE '!'
READ
IF pok = 'Y'
ready = ' '
@ 13, 11 SAY 'Turn printer on & hit any key to continue ' ;
GET ready
READ
SET PRINT ON
ENDIF
CLEAR
?
?
? SPACE(24) + ' * -- LOAN AMORTIZATION -- * '
? SPACE(24) + 'Computation of Number of Periods'
?
? SPACE(19) + 'PRINCIPAL = ' + STR(principal,13,2)
? SPACE(19) + 'PAYMENT/PERIOD = ' + STR(payment,13,2)
? SPACE(19) + 'ANNUAL INTEREST RATE [%] = ' ;
+ SPACE(8) +STR(ann_rate,6,3)
? SPACE(19) + 'NUMBER OF PERIODS/YEAR = ' ;
+ SPACE(8)+STR(y_period,2)
?
? SPACE(19) + 'NUMBER OF PERIODS = ' ;
+ SPACE(7)+STR(t_period,3)
?
ready = ' '
WAIT 'Press Space Bar To Continue ................. ' TO ready
IF pok = 'Y'
SET PRINT OFF
ENDIF
ENDDO WHILE .t.
IF pok = 'Y'
SET PRINT OFF
ENDIF
RETURN
* -- EOF LA_PRVAL