I need some help with a Rule of 72 program I am working on. Having trouble displaying correct output for actual double time. Current code seems work for displaying interest, rule of 72 doubling time, but the actual doubling time seems to have both the incorrect formula and the wrong loop structure. Please lend any assistance possible. Thanks for your help.
Option Explicit On
Option Strict On
Public Class frmRuleOf72
'Declare class level variable to use throughout form.
Dim intRate As Integer = 1
Dim dblRule72 As Double
Dim dblActual As Double
Dim CurrentValue As Double = 1
Private Sub btnEvaluate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEvaluate.Click
For i As Integer = 1 To 20
dblRule72 = 72 / (intRate * (i))
Actual(CurrentValue)
lstDoublingTime.Items.Add("Interest Rate: " & (intRate * (i) & " %"))
lstDoublingTime.Items.Add("Rule of 72 Doubling Time: " & dblRule72)
lstDoublingTime.Items.Add("Actual Doubling Time: " & dblActual)
lstDoublingTime.Items.Add("")
lstDoublingTime.Items.Add("")
Next
End Sub
Sub Actual(ByRef CurrentValue As Double)
For i As Integer = 1 To 20
dblActual = (CurrentValue * (i))
Next
End Sub
End Class
Option Explicit On
Option Strict On
Public Class frmRuleOf72
'Declare class level variable to use throughout form.
Dim intRate As Integer = 1
Dim dblRule72 As Double
Dim dblActual As Double
Dim CurrentValue As Double = 1
Private Sub btnEvaluate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEvaluate.Click
For i As Integer = 1 To 20
dblRule72 = 72 / (intRate * (i))
Actual(CurrentValue)
lstDoublingTime.Items.Add("Interest Rate: " & (intRate * (i) & " %"))
lstDoublingTime.Items.Add("Rule of 72 Doubling Time: " & dblRule72)
lstDoublingTime.Items.Add("Actual Doubling Time: " & dblActual)
lstDoublingTime.Items.Add("")
lstDoublingTime.Items.Add("")
Next
End Sub
Sub Actual(ByRef CurrentValue As Double)
For i As Integer = 1 To 20
dblActual = (CurrentValue * (i))
Next
End Sub
End Class