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.
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
lstOutput.Items.Add(AmountSimple & " Amount Simple Interest" & " ")
lstOutput.Items.Add(AmountCompound & " Amount Compound Interestt" & " ")
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.
Thank you MathMate. You were a great help. I was able to finish creating the program and it works correctly..
Here is what I got to work but I used 2 seperate 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
Answer this Question
computers - an introduction to programming and visual basic 2008 page 39 ...
programming and visual basic - These are two different types of questions, these...
vb programing - I need help to create a project for vb auto center from ...
visual basic programming - Write a Visual Basic program that will calculate the...
Computer Programming - Project: I need help getting start on this project. What ...
Computer programming - Sorting is a common operation used in programming. ...
Computer - Write the program that will calculate and display the career ...
Programming (Visual Basic) - Im seem to be having trouble with this Exercise. ...
VB - Programming in Visual basic 2008 exercise 11.5 Create a project that store ...
Visual Basic (Computer) - What is programming language syntax? Why is it ...