home *** CD-ROM | disk | FTP | other *** search
- * -- PROGRAM NAME: .......... LA_PRVAL.PRG
- * -- PROGRAM TITLE: ......... Loan amortization, Present value or
- * -- Principal
- * -- AUTHOR: ................ Venkat Penugonde
- * Irvine Micro Arts, Irvine, CA
-
- * -- SYSTEM ................. dBASE III or III +
-
- * -- DATE FIRST CREATED .............. 08/02/86
- * -- DATE MOST RECENTLY MODIFIED ..... 08/21/86
- *
- * This program calculates the present value or principal of a laon
- * amortized over a given period.
- *
- * Inputs required ......... 1) Equal Periodic Payment Amount.
- * 2) Total Number of Payment Periods.
- * 3) Annual Interest Rate.
- * 4) Number of Payment Periods per Year.
- *
- * Outputs Generated ....... 1) Present Value or Principal.
- *
-
- pok = 'N'
- DO WHILE .t.
- CLEAR
- payment = 0.00
- ann_rate = 0.000
- t_period = 0
- y_period = 0
- *
- @ 2, 27 SAY '* -- LOAN AMORTIZATION -- *'
- @ 3, 27 SAY ' Computation of Principal'
- @ 6, 11 SAY 'Enter Periodic Payment [0 to exit] ......... $'
- @ 6, 58 GET payment PICTURE '99,999,999.99'
- READ
- IF payment <= 0
- EXIT
- ENDIF
- @ 7, 11 SAY 'Enter Annual Interest Rate [%] .............. '
- @ 7, 66 GET ann_rate PICTURE '99.999'
- @ 8, 11 SAY 'Enter Number of Payment Periods ............. '
- @ 8, 65 GET t_period PICTURE '999'
- @ 9, 11 SAY 'Enter Number of Payment Periods/Year ........ '
- @ 9, 66 GET y_period PICTURE '99'
- READ
-
- IF ann_rate <= 0 .OR. t_period <= 0 .OR. y_period <= 0
- LOOP
- ENDIF
-
- * -- Calucualte interest rate per period
- int_prd = ann_rate/(y_period * 100)
-
- * -- Calculate present value or principal
- numerator = payment * (1 - (1 + int_prd)**(-t_period))
- principal = numerator/int_prd
-
- 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(27) + '* -- LOAN AMORTIZATION -- *'
- ? SPACE(27) + ' Computation of Principal'
- ?
- ? 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 = ' ;
- + SPACE(7)+STR(t_period,3)
- ? SPACE(19) + 'NUMBER OF PERIODS/YEAR = ' ;
- + SPACE(8)+STR(y_period,2)
- ?
- ? SPACE(19) + 'PRINCIPAL = ' + STR(principal,13,2)
- ?
-
- 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
-