Wednesday, December 21, 2011

Future Value Calculator

This program involves the use of the formula 
where  PV represents the present value, FV represents the future value , i is the interest rate and n is the number of periods (Normally months or years). I created a function which have two parameters, namely i and n. Then I wrote the procedure to call this function.
 Public Function FV(PV As Variant, i As Variant, n As Variant) As Variant
'Formula to calculate Future Value(FV)
'PV denotes Present Value
FV = PV * (1 + i / 100) ^ n

End Function

Private Sub compute_Click()
'This procedure will calculate Future Value
Dim FutureVal As Currency
Dim PresentVal As Currency
Dim interest As Variant
Dim period As Variant
PresentVal = PV.Text

interest = rate.Text
period = years.Text

FutureVal = FV(PresentVal, interest, period)
Label5.Caption = Format(FutureVal, "currency")
End Sub

Private Sub period_Change()

End Sub

No comments: