Asked by:
Depreciation to a salvage value of 0

Question
-
For tax purposes an item my be depreciated over a period of years, n. With the straight-line method of depreciation, each year the item depreciates by 1/nth of its original value. (This is where I get confused because the depreciation during the year is added to the depreciation at the end of the next year. Why?) 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:
a) requests description of item, year of purchase, cost, estimated life, and method of depreciation.
b)displays a depreciation schedule for item similar to schedule in figure 6.25
'name: --------------------------- 'date: 4/4/15 'project: Chapter 6 project 4 Option Explicit '# 7 pg. 308 Private Sub cmdStraight_Click() Dim i As String, YrP, c, yrD As Single i = Val(txtItem.Text) 'item YrP = Val(txtYrP.Text) 'year of purchase c = Val(txtCost.Text) 'cost yrD = Val(txtYrDeprec.Text) 'years to depreciate For YrP = 1 To yrD Call showDeprecStraight Next YrP End Sub Private Sub cmdDbl_Click() Dim i As String, YrP, c, yrD As Single i = txtItem.Text 'item YrP = Val(txtYrP.Text) 'year of purchase c = Val(txtCost.Text) 'cost yrD = Val(txtYrDeprec.Text) 'years to depreciate For YrP = 1 To yrD Call showDeprecDbl Next YrP End Sub Private Sub showDeprecStraight() Dim bV As Double, dDy As Double, EoY As Double Dim i As String, YrP, c, yrD As Single i = Val(txtItem.Text) 'item YrP = Val(txtYrP.Text) 'year of purchase c = Val(txtCost.Text) 'cost yrD = Val(txtYrDeprec.Text) 'years to depreciate picDisp.Cls dDy = (1 * c) / yrD bV = c For YrP = 1 To yrD picDisp.Print "Description: "; i, picDisp.Print "Year of Purchase: "; YrP, picDisp.Print "Cost of Item:"; FormatCurrency(c, 2), picDisp.Print "Estimated Life: "; yrD Next YrP End Sub Private Sub showDeprecDbl() Dim bV As Double, dDy As Double, EoY As Double Dim i As String, YrP, c, yrD As Single i = Val(txtItem.Text) 'item YrP = Val(txtYrP.Text) 'year of purchase c = Val(txtCost.Text) 'cost yrD = Val(txtYrDeprec.Text) 'years to depreciate picDisp.Cls dDy = (2 * c) / yrD bV = c For YrP = 1 To yrD picDisp.Print "Description: "; i, picDisp.Print "Year of Purchase: "; YrP, picDisp.Print "Cost of Item: "; FormatCurrency(c, 2), picDisp.Print "Estimated Life: "; yrD Next YrP End Sub Private Sub cmdQuit_Click() End End Sub
this is what I have. I really don't understand what to do here so could I get some help just fixing some things? or at least some tips so that I can figure it out on my own?
- Edited by Dorraj Tuesday, April 7, 2015 3:03 AM Help!
- Edited by Paul Ishak Tuesday, April 7, 2015 3:57 AM Insert code into block
- Moved by Paul Ishak Tuesday, April 7, 2015 3:59 AM VB6 Question off topic in VB.NET forum
Tuesday, April 7, 2015 2:53 AM
All replies
-
this is what I have. I really don't understand what to do here so could I get some help just fixing some things? or at least some tips so that I can figure it out on my own?
Where did this code come from? It doesn't look like .Net code, and will need to be adjusted in order to work in a .Net applcaition.
You should start by setting out what you want to do. Do you have the formulae that you are trying to use? Do you know what input is required for each formaula, and how will you be collecting and validating it? What output are you are expecting to see, and how do you want these results displayed?
You need to set this out in detail, including complete sets of sample data with results, before you start thinking about code. If you set out your task in adequate detail then the process of converting it into code becomes very straightforward. If you try to work out the code at the same time as you work out what you are doing, it just becomes too difficult.
Tuesday, April 7, 2015 3:03 AM -
Oh sorry! Wrong forum. This is VB6.Tuesday, April 7, 2015 3:05 AM
-
Really sorry.Tuesday, April 7, 2015 3:05 AM
-
Thank you for the tips though. I have a basic form layout:
(can't display yet)
I want to display the output so that I get something like:
picDisp.Print "Year",; "Value at Beg of Yr,; "Amount Deprec During Year,; "Total Depreciation to End of Year"
picDisp.Print Tab(2) values obtained from formula in loop (which isn't correct but I don't really know what to write based on what i was given)
Tuesday, April 7, 2015 3:13 AM -
Hello,
VB 6 is no longer supported by Microsoft. I’d suggest asking in one of the following third-party forums which support Visual Basic 6.
VB forums VB City For further information, see: Where to post your VB 6 questionsKarl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})Tuesday, April 7, 2015 7:54 PM