# Visual Basic 2008 Programming

posted by .

Help! I'm not sure how to start or how calculate. This is the project. Using For Next Loops.

- When \$1000 is deposited at 5 percent simple interest, the amount grows by \$50 each year. When money is invented at 5 percent compound interest, then the amount at the end of each year is 1.05 times the amount at the beginning of that year. Write a program to display the amounts for 10 years for a \$1000 deposit at 5 percent simple and compound interest. The first few lines displayed in the list box should appear as in Figure 6.8

--------------------------------------
Amount Amount
Simple Compound
Year Interest Interest
1 \$1,050.00 \$1,050.00
2 \$1,100.00 \$1,102.50
3 \$1,150.00 \$1,157.63

Figure 6.8 Growth of \$1000 at simple and compound interest.
---------------------------------------

• Visual Basic 2008 Programming -

You will need to declare two decimal variables, AmountSimple, and AmountCompound.
They should be initialized to 1000 as a start.
Write a for-loop that goes over 10 times (years) and accumulate \$50 each year for the simple interest case. For the compound interest, multiply the previous amount by 1.05, or AmountCompound=AmountCompound*1.05

Output (inside the loop) the values of AmountSimple and AmountCompound, taking care to limit the number of digits after the decimal point to 2, with rounding.

Create and run your program. Post the code if you have difficulties.

• Visual Basic 2008 Programming -

Okay this is my Code: My coding is quite a bit off. Help me please. Thanks.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim AmountCompound As Integer = 1000
For AmountSimple As Integer = 1 To 10
AmountSimple = 1000
AmountSimple += 50

If AmountCompound = 1000 Then
AmountCompound = AmountCompound * 1.05
End If
lstOutput.Items.Add(AmountSimple & " Amount Simple Interest" & " ")
lstOutput.Items.Add(AmountCompound & " Amount Compound Interestt" & " ")

Next

End Sub
End Class

• Visual Basic 2008 Programming -

The program almost works! Just missing a few little details.

0. As suggested, you will need to define AmountSimple and AmountCompound as Decimal. As it is (Integer), you will be able to display to the dollar, no cents.

1. The For variable should not be AmountSimple. Call it Year and declare it before the for statement.
You'll need it for output.

2. "If AmountCompound = 1000 Then... "
The if condition is not needed, it should be multiplied in all 10 cases.

3. The output with a lot of text is hard to read. For 10 years, it is better to make it in table form.
To make the table correctly, you will need some form of format control to display 2 digits after the decimal point. Otherwise it will look like this:

Year Simple Compound
1 1050 1050
2 1100 1102.5
3 1150 1157.625
4 1200 1215.50625
...

Keep up the good work.

• Visual Basic 2008 Programming -

Thank you MathMate. You were a great help. I was able to finish creating the program and it works correctly..

• Visual Basic 2008 Programming -

Here is what I got to work but I used 2 separate lists

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num As Double = 1
Dim Init_Inv As Integer = 1000
Do Until num = 10
Init_Inv = Init_Inv * 1.05
Compound.Items.Add("Year " & num & " | " & FormatCurrency(Init_Inv))
Simple.Items.Add("Year " & num & " | " & FormatCurrency((num * 50) + 1000))
num += 1
Loop

End Sub

• Visual Basic 2008 Programming -

Public Class Form1

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim Compound As Double = 5000
Dim Simple As Double = 5000
Dim i As Integer = 400

lstOutput.Items.Add(vbTab & "Amount" & vbTab & vbTab & "Amount")
lstOutput.Items.Add("Year" & vbTab & "Simple Interest" & vbTab & "Compound Interest")
lstOutput.Items.Add(1 & vbTab & Simple + i & vbTab & vbTab & Compound + (Compound * 0.08))
lstOutput.Items.Add(2 & vbTab & Simple + (i * 2) & vbTab & vbTab & Compound + (Compound * 0.08) * 2)
lstOutput.Items.Add(3 & vbTab & Simple + (i * 3) & vbTab & vbTab & (Compound) + (Compound * 0.08) * 3)
lstOutput.Items.Add(4 & vbTab & Simple + (i * 4) & vbTab & vbTab & Compound + (Compound * 0.08) * 4)
lstOutput.Items.Add(5 & vbTab & Simple + (i * 5) & vbTab & vbTab & Compound + (Compound * 0.08) * 5)
lstOutput.Items.Add(6 & vbTab & Simple + (i * 6) & vbTab & vbTab & Compound + (Compound * 0.08) * 6)
lstOutput.Items.Add(7 & vbTab & Simple + (i * 7) & vbTab & vbTab & Compound + (Compound * 0.08) * 7)
lstOutput.Items.Add(8 & vbTab & Simple + (i * 8) & vbTab & vbTab & (Compound) + (Compound * 0.08) * 8)
lstOutput.Items.Add(9 & vbTab & Simple + (i * 9) & vbTab & vbTab & Compound + (Compound * 0.08) * 9)
lstOutput.Items.Add(10 & vbTab & Simple + (i * 10) & vbTab & vbTab & Compound + (Compound * 0.08) * 10)

End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class

## Similar Questions

1. ### Economic

All of the following refer to the Economy of Ecoland: - GDP in 1990 is \$1000 - Annual inflation is 5% per year from 1991 - 1995. From 1996 - 1999, inflation is 10% per year - Real GDP grows at 2% every year a) Calculate real GDP from …
2. ### programming and visual basic

These are two different types of questions, these are not the same questions The Some interest Credit Company provides loans to customers at 1.5 percent interest per month. Design an application that gets customer account data that …
3. ### computers

an introduction to programming and visual basic 2008 page 39 programming challenges rules form design and flowchart for #3 sales tax. how do i do this?
4. ### vb programing

I need help to create a project for vb auto center from Programming in Visual Basic 2008 Chapter 11 pg 468. Write a project to store vehicle information including model, manufacturer, year, and VIN number. Create a second project that …
5. ### computer science

When \$1000 is deposit at 5% simple interest, the amount grows by \$50 each year. When money is invested at 5% compound interest, then the amount at the end of each year is 1.05 times the amount at the beginning of the year. Write a …
6. ### matlab

One bank pays 5.5 percent annual interest, while a second bank pays 4.5 percent annual interest. Determine how much longer it will take to accumulate at least \$50 000 in the second bank account if you deposit \$1000 initially and \$1000 …
7. ### algebra

A total of \$6200 is deposited into two simple interest accounts. On one account the annual simple interest rate is 2%, and on the second account the annual simple interest rate is 4%. The amount of interest earned for 1 year was \$148. …
8. ### Algebra

Maybe that was to confusing...we have a data sheet to fill out - 2 questions with simple interest and 2 with compound interest. I just need the simple interest help: Prob. #1 Find the total amount if you deposit \$500. at a rate of …
9. ### Computer Science

i Need help, using loops, visual studio 2013. write a program using loops that will calculate the following, how much would \$24 deposited in a bank in 1626, have been worth at the end of this year if it had received an interest rate …
10. ### VISUAL BASIC PROGRAMMING

3. WRITE A VISUAL BASIC PROGRAM TO CALCULATE THE SIMPLE INTEREST ON A LOAN AMONUT OF 50000 GHANA CEDIS AT AN INTEREST RATE OF 30% FOR A NUMBER OF YEARS WHICH WILL BE SPECIFIED BY THE USER.

More Similar Questions