Home

Math Functions: The Future Value of an Investment

     

Introduction

The FutureValue() function is used to calculate the future value of an investment. The syntax of this function is:

Extended __fastcall FutureValue(Extended Rate,
                                int NPeriods,
                                Extended Payment,
                                Extended PresentValue,
                                TPaymentTime PaymentTime);

Here is an example of calling this function:

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

#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 Period;

	Present = StrToFloat(edtPresentValue->Text);
	Payment = StrToFloat(edtMonthlyPayment->Text);
	Period = StrToInt(edtPeriods->Text);
	Rate = StrToFloat(edtInterestRate->Text);
	Future = labs(FutureValue(Rate / 100, Period, Payment,
	 Present, ptEndOfPeriod));

	edtFutureValue->Text = FloatToStrF(Future, ffCurrency, 8, 2);
}
//---------------------------------------------------------------------------
void __fastcall TfrmExercise::btnCloseClick(TObject *Sender)
{
	Close();
}
//---------------------------------------------------------------------------
Future Value
   

 

 
 
     
 

Home Copyright © 2010-2011 FunctionX, Inc.