1 Replies - 1934 Views - Last Post: 01 October 2012 - 11:56 PM Rate Topic: -----

#1 compucrazy  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 30-September 12

Depreciation program help please!

Posted 01 October 2012 - 07:48 PM

Hi!

I am trying to write a program that shows depreciation over a period of several years. This is what I have so far but I still don't know how to show the year-by-year description of depreciation like I have below. Please help!


Public Class frmDepreciation

    Dim item As String
    Dim Year As Double
    Dim Cost As Double
    Dim Estimate As Double
    Dim SalvageValue As Integer = 0.0
    Dim LineFormula As Double
    Dim DoubleDeclining As Double
    Dim Depreciation As Double
    Dim Balance As Double
    Dim Beginningval As Double
    Dim EndVal As Double
    Dim Total As Double
    Dim Counter As Double

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

        item = txtDescription.Text
        Year = Val(txtPurchase.Text)
        Cost = Val(txtCost.Text)
        Estimate = Val(txtEstimate.Text)

        'For Figuring Depreciation
        Depreciation = Cost / 2
        Balance = Cost - Depreciation

        DoubleDeclining = (Cost - SalvageValue / Estimate) * 2

        lstTotals.Items.Clear()
        lstTotals.Items.Add("Description: " & item)
        lstTotals.Items.Add("Year of Purchase: " & Year)
        lstTotals.Items.Add("Cost: " & FormatCurrency(Cost))
        lstTotals.Items.Add("Estimated life: " & Estimate)
        lstTotals.Items.Add("Method of Deprection: Double-Declining Balance")
        lstTotals.Items.Add("")

        lstTotals.Items.Add("Value at beginning of " & Year & ": " & FormatCurrency(Cost))
        lstTotals.Items.Add("Amount of depreciation during " & Year & ": " & FormatCurrency(Depreciation))
        lstTotals.Items.Add("Total depreciation at the end of " & Year & ": " & FormatCurrency(Balance))


        

    End Sub


    Private Sub btnStraightLine_Click(sender As System.Object, e As System.EventArgs) Handles btnStraightLine.Click

        item = txtDescription.Text
        Year = Val(txtPurchase.Text)
        Cost = Val(txtCost.Text)
        Estimate = Val(txtEstimate.Text)
        LineFormula = (Cost - SalvageValue / Estimate)

        lstTotals.Items.Clear()
        lstTotals.Items.Add("Description: " & item)
        lstTotals.Items.Add("Year of Purchase: " & Year)
        lstTotals.Items.Add("Cost: " & FormatCurrency(Cost))
        lstTotals.Items.Add("Cost: " & Estimate)
        lstTotals.Items.Add("Method of Deprection: Straight Line")
        lstTotals.Items.Add("")

        lstTotals.Items.Add("Value at beginning of " & Year & ": " & FormatCurrency(Cost))
        lstTotals.Items.Add("Amount of Depreciation during " & Year & ": " & FormatCurrency(Depreciation))
        lstTotals.Items.Add("Total Depreciation at end of " & Year & ": " & FormatCurrency(Total))
       
        Depreciation = Cost / Estimate
        Beginningval = Cost - Depreciation
        EndVal = Beginningval - Depreciation
        Total = Cost - EndVal
    End Sub
End Class


Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: Depreciation program help please!

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,776
  • Joined: 26-March 09

Re: Depreciation program help please!

Posted 01 October 2012 - 11:56 PM

Look at using a loop around the calculation and yearly output details for the number of years, see if that gives you what you need.

For example

For intLoop = 1 to intNumYears

' Calculations and update variables

' Output your yearly details text here.

Next intLoop
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1