VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Calculates Compounded Maturity Amount given the principal, rate and period

by Stephen Nicholas (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 2nd July 2007
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Calculates Compounded Maturity Amount given the principal, rate and period

Rate Calculates Compounded Maturity Amount given the principal, rate and period



    Dim principal As Integer
    Dim intRate As Integer
    Dim years As Integer
    Dim interest As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub Principal_Amount_Changed(ByVal sender As Object, ByVal e As System.EventArgs) Handles PrincipalAmount.TextChanged
        CalculateFinalTotal()
    End Sub

    Private Sub Interest_Rate_Changed(ByVal sender As Object, ByVal e As System.EventArgs) Handles InterestRate.TextChanged
        CalculateFinalTotal()
    End Sub

    Private Sub Years_Deposited_Changed(ByVal sender As Object, ByVal e As System.EventArgs) Handles YearsDeposited.TextChanged
        CalculateFinalTotal()
    End Sub

    Private Sub CalculateFinalTotal()
        If PrincipalAmount.Text = "" Or InterestRate.Text = "" Or YearsDeposited.Text = "" Then
            TotalAmount.Text = ""
        Else
            principal = CInt(PrincipalAmount.Text)
            intRate = CInt(InterestRate.Text)
            years = CInt(YearsDeposited.Text)
            interest = CalcInt(principal, intRate, years)
            TotalAmount.Text = interest
        End If
    End Sub

    Function CalcInt(ByVal P As Integer, ByVal R As Integer, ByVal N As Integer) _
    As Integer
        Return P * (1 + R / 100) ^ N
    End Function
End Class

Download this snippet    Add to My Saved Code

Calculates Compounded Maturity Amount given the principal, rate and period Comments

No comments have been posted about Calculates Compounded Maturity Amount given the principal, rate and period. Why not be the first to post a comment about Calculates Compounded Maturity Amount given the principal, rate and period.

Post your comment

Subject:
Message:
0/1000 characters