Hello, Everyone!

Im hoping you can help me complete my project. Im currently stuck on single depreciation and cannot find out why it wont calculate correctly and will not show up in my list box using a loop.

Below is my teachers instuctions, followed by my acual code from VB.



Instructions:


CIT201 Programming Assignment 4 - Depreciation

For tax purposes an item may be depreciated over a period of several years, n. With the straight-line method of depreciation, each year the item depreciates by l/nth of its original value. With the double-declining-*balance method of depreciation, each year the item depreciates by 2/nths of its value at the beginning of that year. (In the last year, it is depreciated by its value at the beginning of the year.) Write a program that performs the following tasks:



(a) Requests a description of the item, the year of purchase, the cost of the item, the number of years to be depreciated (estimated life), and the method of depreciation. The method of depreciation should be chosen by clicking one of two buttons.



(b) Displays a depreciation schedule for the item similar to the schedule shown below:


What the program will look like once its done(excluding the values you need to enter)


Description: Computer

Year of purchase: 2008

Cost: $2,000.00

Estimated life: 5

Method of depreciation: double-declining-balance



Value at Annual Value at Total

Year Beg of Yr Deprec End of Yr Depreciation

2008 2,000.00 800.00 1,200.00 800.00

2009 1,200.00 480.00 720.00 1,280.00

2010 720.00 288.00 432.00 1,568.00

2011 432.00 172.80 259.20 1,740.80

2012 259.20 259.20 0.00 2,000.00







My Code from Visual Basic 2008



Public Class Project4
Dim dblCost, dblLife, dblYear, DblDepreciation, dblBegValue, dblEndValue, dblTotal, Counter
Private Sub lstOutput_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstOutput.SelectedIndexChanged

End Sub

Private Sub btnStraight_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStraight.Click


' Setting Columns, minus sign indicates left justification, default is right justification
Dim fmtSTR As String = "{0,-22}{1,22}{2,22}{3,22}{4,22}"


'Declare Variables
dblCost = Val(txtCost.Text)
dblLife = Val(txtLife.Text)
dblYear = Val(txtYear.Text)



'Info for List Box
lstOutput.Items.Clear()
lstOutput.Items.Add("Depscription" & txtDescription.Text)
lstOutput.Items.Add("Year of Purchase:" & txtYear.Text)
lstOutput.Items.Add("Cost:" & txtCost.Text)
lstOutput.Items.Add("Estimated Life:" & txtLife.Text)
lstOutput.Items.Add("Method of Deprection: Straight Line")

'Titles for Table in List Box
lstOutput.Items.Add(String.Format(fmtSTR, "Year", "Value at Beg.of Year", "Annual Deprec", "Value at End of Yr.", "Total Depreciation"))

'Declare Loop Counters
Dim intA As Integer




'For Figuring Depreciation
DblDepreciation = dblCost / dblLife


'Fpr Figuring Begining Value
dblBegValue = dblCost
Counter = dblCost - DblDepreciation



'Loop for Straight Life Depreciation
For intA = 1 To dblLife
lstOutput.Items.Add(dblYear)



dblBegValue = dblCost - DblDepreciation
lstOutput.Items.Add(" ")

dblTotal = dblCost - dblEndValue



dblEndValue = dblBegValue - DblDepreciation
Next



End Sub

Private Sub btnDouble_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDouble.Click

' Setting Columbs, minus sign indicates left justification, default is right justification
Dim fmtSTR As String = "{0,-22}{1,22}{2,22}{3,22}{4,22}"

'Declare Variables
dblCost = Val(txtCost.Text)
dblLife = Val(txtLife.Text)
dblYear = Val(txtYear.Text)



'Info for List Box
lstOutput.Items.Clear()
lstOutput.Items.Add("Depscription" & txtDescription.Text)
lstOutput.Items.Add("Year of Purchase:" & txtYear.Text)
lstOutput.Items.Add("Cost:" & txtCost.Text)
lstOutput.Items.Add("Estimated Life:" & txtLife.Text)
lstOutput.Items.Add("Method of Deprection: Double Declining")


'Titles for Table in List Box
lstOutput.Items.Add(String.Format(fmtSTR, "Year", "Value at Beg.of Year", "Annual Deprec", "Value at End of Yr.", "Total Depreciation"))


DblDepreciation = dblCost / dblLife
dblBegValue = dblCost - DblDepreciation
dblEndValue = dblBegValue - DblDepreciation
dblTotal = dblCost - dblEndValue







End Sub


End Class