Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Visual Basics, write a program: When $1000 is invested at 5 % simple inter

ID: 3690600 • Letter: U

Question

Using Visual Basics, write a program: When $1000 is invested at 5 % simple interest, the amount grows by $50 each year. When money is invested at 5 % interest compounded annually, the amount at the end of each year is 1.05 times the amount at the beginning of that year. Display the amounts for 9 years for a $1000 investment at 5 % simple and compound interest.

This is what i have no far...

Private Sub BtnDisplay_Click(sender As Object, e As EventArgs) Handles BtnDisplay.Click
Dim AmountCompound As Double = 1000 * 1.05
Dim AmountSimple As Double = 1000 + 50
Dim Year As Integer
Year += 1
For Year = 1 To 10
lstInterest.Items.Add("" & " " & " Simple Interest " & " " & "Compound Interest")
lstInterest.Items.Add(CStr(Year) & " " & AmountSimple & " " & AmountCompound)


AmountSimple += 50
AmountCompound = AmountCompound * 1.05

Next

End Sub
End Class

Interest Display Growth of Money SIMPLE COMPOUND YEAR INTEREST INTEREST $1,050.00 1,050.00 2 $1,100.00$1,102.50 1,150.00 $1,157.63 4$1,200.00$1,215.51 $1,250.00 $1,276.28 6 $1,300.00 $1,340.10 7$1,350.00 $1,407.10 $1,400.00 1,477.46 9$1,450.00 $1,551.33

Explanation / Answer

Bellow code is using ListView:

Note: i think your code is not dispaly correctly

Private Sub BtnDisplay_Click(sender As Object, e As EventArgs) Handles BtnDisplay.Click

Dim AmountCompound As Double = 1000 * 1.05
Dim AmountSimple As Double = 1000 + 50
Dim Year As Integer
''Set view property
lstInterest.View = View.Details
lstInterest.GridLines = True
lstInterest.FullRowSelect = True

'Add column header
lstInterest.Columns.Add("YEAR", 80)
lstInterest.Columns.Add("SIMPLE INTEREST ", 120)
lstInterest.Columns.Add("COMPOUND INTEREST", 135)

'Add items in the listview
Dim arr(3) As String
Dim itm As ListViewItem

Year += 1
For Year = 1 To 10
'Add items
arr(0) = CStr(Year)
arr(1) = "$" & [String].Format("{0:0,0.00}", AmountSimple)
arr(2) = "$" & [String].Format("{0:0,0.00}", AmountCompound)
itm = New ListViewItem(arr)
lstInterest.Items.Add(itm)
'ListView1.Items.Add(CStr(Year) & " " & AmountSimple & " " & AmountCompound)
AmountSimple += 50
AmountCompound = AmountCompound * 1.05
Next

End Sub

Below code is using gridview control this is the another way:

Private Sub BtnDisplay_Click(sender As Object, e As EventArgs) Handles BtnDisplay.Click

Dim myList As New List(Of MyObject)()
Dim AmountCompound As Double = 1000 * 1.05
Dim AmountSimple As Double = 1000 + 50
Dim Year As Integer
Year += 1
For Year = 1 To 10
myList.Add(New MyObject(CStr(Year), "$" & [String].Format("{0:0,0.00}", AmountSimple), "$" & [String].Format("{0:0,0.00}", AmountCompound)))

AmountSimple += 50
AmountCompound = AmountCompound * 1.05
Next
DataGridView1.DataSource = myList
End Sub
Public Class MyObject

Public Sub New(YEAR As Integer, SIMPLEINTEREST As String, COMPOUNDINTEREST As String)
_YEAR = YEAR
_SIMPLEINTEREST = SIMPLEINTEREST
_COMPOUNDINTEREST = COMPOUNDINTEREST
End Sub
Private _YEAR As Integer
Public Property YEAR() As Integer
Get
Return _YEAR
End Get
Set(value As Integer)
_YEAR = value
End Set
End Property
Private _SIMPLEINTEREST As String
Public Property SIMPLEINTEREST() As String
Get
Return _SIMPLEINTEREST
End Get
Set(value As String)
_SIMPLEINTEREST = value
End Set
End Property
Private _COMPOUNDINTEREST As String
Public Property COMPOUNDINTEREST() As String
Get
Return _COMPOUNDINTEREST
End Get
Set(value As String)
_COMPOUNDINTEREST = value
End Set
End Property
End Class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote