Public Class interest ' calculate compound interest factor, given rate% and number of periods Private Function CompoundInterest(ByVal rate As Double, ByVal number As Double) As Double Return (1 + rate / 100) ^ number End Function ' calculate monthly repayment given capital, rate% per month, and number of months Private Function MonthlyRepayment(ByVal capital As Double, ByVal rate As Double, ByVal number As Double) As Double Return capital * (rate / 100) / (1 - 1 / CompoundInterest(rate, number)) End Function ' perform calculation and display results Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim capital As Double = TextBox1.Text Dim rate As Double = TextBox2.Text / 12 Dim period As Double = TextBox3.Text * 12 TextBox4.Text = MonthlyRepayment(capital, rate, period).ToString("F02") TextBox5.Text = CInt(period * MonthlyRepayment(capital, rate, period)) End Sub End Class