Q [An Introduction to Programming using Visual Basic Ed 11, Ch 6.2 Q# 26]- When $1,000 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 the year is 1.05 times the amount at the beginning of that year. Display the amounts for 9 years for a $1,000 investment at 5% simple and compound interest. My Answer: Private Sub btnComputeGrowthMoney_Click(sender As Object, e As EventArgs) Handles btnComputeGrowthMoney.Click 'Display simple interest and compound interest from 1 to 9 Dim simple, compound, principal As Decimal Dim rate As Double Dim year As Integer lstInterest.Items.Clear() principal = 1000 rate = 0.05 simple = principal * (1 + rate * year) compound = principal * (1 + rate) ^ year For year = 1 To 9 lstInterest.Items.Add("YEAR" & " " & "SIMPLE INTEREST" & " " & "COMPOUND INTEREST") lstInterest.Items.Add(year & " " & simple.ToString("N") & " " & compound.ToString("C")) Next End Sub Error message after running the script Severity Code Description Line Suppression State Error BC30456 'Items' is not a member of 'TextBox'. 9 Active
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Q [An Introduction to Programming using Visual Basic Ed 11, Ch 6.2 Q# 26]- When $1,000 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 the year is 1.05 times the amount at the beginning of that year. Display the amounts for 9 years for a $1,000 investment at 5% simple and compound interest.
My Answer:
Private Sub btnComputeGrowthMoney_Click(sender As Object, e As EventArgs) Handles btnComputeGrowthMoney.Click
'Display simple interest and compound interest from 1 to 9
Dim simple, compound, principal As Decimal
Dim rate As Double
Dim year As Integer
lstInterest.Items.Clear()
principal = 1000
rate = 0.05
simple = principal * (1 + rate * year)
compound = principal * (1 + rate) ^ year
For year = 1 To 9
lstInterest.Items.Add("YEAR" & " " & "SIMPLE INTEREST" & " " & "COMPOUND INTEREST")
lstInterest.Items.Add(year & " " & simple.ToString("N") & " " & compound.ToString("C"))
Next
End Sub
Error message after running the script
Severity |
Code |
Description |
Line |
Suppression State |
||
Error |
BC30456 |
'Items' is not a member of 'TextBox'. |
9 |
Active |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images