Hello, I am doing a project for class-here is the assignment:
Suppose $800 is deposited into a savings account earning 4% interest compounded annually, and $100 is added to the account at the end of each year. Calculate the amount of money in the account at the end of 10 years. Determine a formula for computing the balance at the end of one year based on the balance at the beginning of the year. Allow the user to input the beginning balance and the amount to be contributed at the end of each year. You must a loop in this program.
here is the code I have so far:
I cannot figure out how to make the previous years balance become the next years and so forth.
Any suggestions? Thanks
Suppose $800 is deposited into a savings account earning 4% interest compounded annually, and $100 is added to the account at the end of each year. Calculate the amount of money in the account at the end of 10 years. Determine a formula for computing the balance at the end of one year based on the balance at the beginning of the year. Allow the user to input the beginning balance and the amount to be contributed at the end of each year. You must a loop in this program.
here is the code I have so far:
HTML:
Public Class Savings
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
Dim intrest As Decimal
Dim bonus As Integer
Dim endofyear As Integer
Dim balance As Integer
Dim years As Integer
Dim contributed As Integer
Dim summary As Integer
balance = CInt(InputBox("Insert your beginning balance"))
bonus = CInt(InputBox("Insert amount contributed each year"))
intrest = 0.04 * balance
years = 10
lstAccount.Items.Add("Beginning/End of year")
For summary = 1 To years
endofyear = balance + bonus + intrest
lstAccount.Items.Add(balance & ControlChars.Tab & endofyear & ControlChars.Tab & summary & ControlChars.Tab)
Next
lstAccount.Items.Add("------------------…
contributed = bonus
lstAccount.Items.Add("Contributed amount:" & contributed)
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
I cannot figure out how to make the previous years balance become the next years and so forth.
Any suggestions? Thanks