Finance Functions: |
|
The InterestPayment() function is used to calculate the amount paid as interest for a loan. Its syntax is: Extended __fastcall InterestPayment(const Extended Rate, int Period, int NPeriods, const Extended PresentValue, const Extended FutureValue, TPaymentTime PaymentTime); The PresentValue parameter is the current value of the item. It could be the marked value of the car, the current mortgage value of a house, or the cash amount that a bank is lending. The NPeriods is the number of periods that occur during a yearly cycle of the loan. The Rate argument is a fixed percent value applied during the life of the loan. The Period argument represents the payment period. The FutureValue is the total amount that the customer will have paid when the loan is paid off. The PaymentTime specifies whether the periodic (such as monthly) payment of the loan is made at the beginning or end of the period. Here is an example: //--------------------------------------------------------------------------- void __fastcall TForm1::btnCalculateClick(TObject *Sender) { Extended Present, Future, Payment, TheRate; int Periods, NPeriod; Present = StrToFloat(edtPresent->Text); Future = StrToFloat(edtFuture->Text); Periods = StrToInt(edtPeriod->Text); NPeriod = StrToInt(edtNPeriods->Text); TheRate = StrToFloat(edtRate->Text) / 12; double Rate = TheRate /100; Payment = InterestPayment(Rate, Periods, NPeriod, Present, Future, ptEndOfPeriod); edtPayments->Text = FloatToStrF(Payment, ffCurrency, 8, 2); } //--------------------------------------------------------------------------- |
Home | Copyright © 2004-2016, FunctionX, Inc. | |