top of page
The Code
Website Links-173.jpg

Public Class MyClassCompound_InterestFormula


    '## Percentage Increment MyClassMyClassPercentageIncrement---- -------------##
    '## [1]Encapsulation - Self Contained Modules ---------------------------------##
    '## [2]Inheritance - Structured Class to be passed by Hierarchy Inheritance -------##
    '## [3]Polymorphism - Modules represent Real World Objects known as Classes-- ##
    '## Set Decimal Place to n2 Places --------------------------------------------##

    Dim DecimalPlace As String = "n2"

    Public Function Compound_InterestFormula(ByVal Principle As Single, ByVal Rate As Single, ByVal InterestCalculatePerYear As Single, ByVal NumberYears As Single)

        '## Amount = Principle(1 + (Rate/InterestCalculatePerYear))^(InterestCalculatePerYear * NumberYears))) Formula ===========================##
        Compound_InterestFormula = ((Principle * ((1 + (Rate / 100) / InterestCalculatePerYear)) ^ (InterestCalculatePerYear * NumberYears))).ToString(DecimalPlace)

        '## =================================================================================================##

    End Function


End Class

download (2).png

Public Class Form106

    Private Sub CalculateBtn_Click(sender As Object, e As EventArgs) Handles CalculateBtn.Click


        '##=================Dimension Objects & Variables================## 
        '## Dimension MyPercentage_OriginalValue as Object ----------------------------##
 
        Dim
MyCompound_InterestFormula As Object

        '## MyPercent_OriginalValue = MyClassFindOriginal_PercentageDecrementValue()---##
        MyCompound_InterestFormula = New MyClassCompound_InterestFormula

        '## -------------Dimension Variables as Single Precision -------------------------##
        Dim Principle As Single
        Dim
Rate As Single
        Dim
InterestCalculatePerYear As Single
        Dim
NumberYears As Single
       
'##=====================================================##

 


        '## ========== Assign Label Error Format =========================##
        '## Reset Lbl_Answer.Text Forecolor to Blue -------------------------------------##

        LblAmount.ForeColor = Color.Blue
       
'## =====================================================##

 


        '##============== Assign Error HANDLING ========================##
        '## Try... Catch... End Try... Structure -----------------------------------------------##
        '## Error Handling Routine -------------------------------------------------------##

        Try
           
'##====================================================##

 

 


            '##============= Assign Numeric TextBox Values ==================##
            '## ------------ Arithmetic Format Forms -------------------------------------##
            '## Assign Numeric Values to Variables -----------------------------------------##

            Principle = TxtPrincipleValue.Text
            Rate = TxtInterestRate.Text
            InterestCalculatePerYear = TxtInterestCalYearly.Text
            NumberYears = TxtPeriodYears.Text

            '## Assign Value to Label.Text Compound Interest Formula -----------------------##
            
 LblAmount.Text = (MyCompound_InterestFormula.Compound_InterestFormula(Principle, Rate, InterestCalculatePerYear, NumberYears))
           
'##===================================================================================##

 

            '##====================Catch Non_Numeric Exception===========================================## 
            '## Try... Catch... End Try... Structure Non_NumericInput As Exception----------------------------------------------------------##

        Catch Non_NumericInput As Exception
           
'##==================================================================================##

 

            '##=================Program Flow SubRoutine Error Handling=======================================## 
            '## Catch Non Numeric Input as Error --------------------------------------------------------------------------------------##

            NonNumericInput()
           
'##===================================================================================##

 

            '##======================== End Try [Error Handling] ===========================================##
        End Try
       
'##=====================================================================================##

    End Sub

 


    '## =================== Error Handling Subroutine ==================================================##
    '## Sub[1] ---------------------------------------------------------------------------------------------------------------------##
    '## Error Handling Message Routine ---------------------------------------------------------------------------------------------##

    Sub NonNumericInput()

        LblAmount.ForeColor = Color.Red
        LblAmount.Text = "Enter Numeric Value"
       
'##=====================================================================================##

 

    End Sub


    Private Sub ClearBtn_Click(sender As Object, e As EventArgs) Handles ClearBtn.Click


        '## ============= Clear Text & Label Boxes =======================================================##
        '## Clear Text and Label Boxes for Re-Evaluation -------------------------------------------------------------------------------##

        TxtPrincipleValue.Text = ""
       
TxtInterestRate.Text = ""
       
TxtInterestCalYearly.Text = ""
       
TxtPeriodYears.Text = ""
       
LblAmount.Text = ""
       
'## =====================================================================================##


    End Sub

    Private Sub Form106_Load(sender As Object, e As EventArgs) Handles MyBase.Load


        '## ====== Delete Label Box Names at Start up Procedure ==================================================##
        LblAmount.Text = ""
       
'## ======================================================================================##


    End Sub


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


        '## Programs using only [1] Form ===========================##
        '## Change below to Me.Close()  ============================##
        '## ====== Go To Menu 105 =============================##

        Form105.Show()
        Me.Hide()
       
'## ===============================================##

 

    End Sub

 

End Class

   

bottom of page