Example: Future Value of an Investment
A couple starts setting aside $30,000 a year when they are 45 years old. They expect to earn 5% interest on the money compounded yearly. The future value of the investment is computed for a 20 year period.
using System;
using Imsl.Finance;
public class fvEx1
{
public static void Main(String[] args)
{
double rate = .05;
int nper = 20;
double payment = - 30000.00;
double pv = - 30000.00;
double fv = Finance.Fv(rate, nper, payment, pv,
Finance.Period.AtBeginning);
Console.Out.WriteLine("After 20 years, the value of the " +
"investments " + "will be " +
fv.ToString("C"));
}
}
Output
After 20 years, the value of the investments will be $1,121,176.49
Link to C# source.