Home

Math Functions: The Amount Paid as Interest

     

Introduction

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:

//---------------------------------------------------------------------------

#include <vcl.h>
#include <math.hpp>
#pragma hdrstop

#include "Exercise.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TfrmExercise *frmExercise;
//---------------------------------------------------------------------------
__fastcall TfrmExercise::TfrmExercise(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmExercise::btnCalculateClick(TObject *Sender)
{
	Extended Present, Future, Payment, Rate;
	int Periods, NPeriod;

	Present = StrToFloat(edtPresentValue->Text);
	Future = StrToFloat(edtFutureValue->Text);
	Periods = StrToInt(edtPeriod->Text);
	NPeriod = StrToInt(edtNPeriods->Text);
	Rate = StrToFloat(edtInterestRate->Text) / 12;

	Payment = InterestPayment(Rate / 100,
				  Periods,
				  NPeriod,
				  Present,
				  Future,
				  ptEndOfPeriod);
	edtMonthlyPayment->Text = FloatToStrF(labs(Payment), ffCurrency, 8, 2);
}
//---------------------------------------------------------------------------
Amount Paid as Interest
   

 

 
 
     
 

Home Copyright © 2010-2016, FunctionX