Finance Functions:
The Amount Paid as Principal


While the InterestPayment() function calculates the amount paid as interest for a loan, the PeriodPayment() function calculates the actual amount that applies to the balance of the loan. This is referred to as the principal. Its syntax is:

Extended __fastcall PeriodPayment(constExtended Rate,
                                  int Period,
                                  int NPeriods,
                                  const Extended PresentValue,
                                  const Extended FutureValue,
                                  TPaymentTime PaymentTime);

Here is an example:

void __fastcall TForm1::btnCalculateClick(TObject *Sender)
	Extended Present, Future, TheRate, PPayment;
	int Periods, NPeriod;
	Present = StrToFloat(edtLoan->Text);
	Future = StrToFloat(edtFuture->Text);
	TheRate = StrToFloat(edtRate->Text) / 12;
	Periods = StrToInt(edtPeriod->Text);
	NPeriod = StrToInt(edtNPeriods->Text);
	double Rate = TheRate / 100;
	// Apply the function
	PPayment = PeriodPayment(Rate, Periods, NPeriod, -Present, Future, ptStartOfPeriod);
	// Display the payment
	edtPPMT->Text = FloatToStrF(PPayment, ffCurrency, 8, 2);
Home Copyright 2004 FunctionX, Inc.