VS 2008 Depreciation Loop - Calculate Straight-line Depreciation (cost * 1/n) N Being The Number Of Years To Depreciate
Jul 25, 2010
I have a program where I have to calculate straight-line depreciation (cost * 1/n) n being the number of years to depreciate, and Double-Declining depreciation (cost * 2/n) using user input for year of purchase, cost, and years of depreciation. The output needs to be put into 4 columns in a list box. Year, Value at beginning of year, Amount of depreciation during the year and Total depreciation to the end of the year.
The problem I am having is with my loop. It is not properly calculating. I'm sure I am doing something wrong that is simple, but I can't see it.
Here is my code; the problem areas are bold:
Public Class frmDepreciation
Dim Cost, Life, Year, Depreciation, BegValue, EndValue, Total, Counter As Double
Dim fmtStr As String = "{0,-10}{1,10}{2,17}{3,5}{4,-15}"
Dim fmtStr2 As String = "{0,-10}{1,10}{2,17}{3,15}"
[CODE]....
View 3 Replies
ADVERTISEMENT
Jan 4, 2012
iam making a program to calculate depreciation (just to apply what I learned) and when I run the program and made the input, I get an error that says "Please input numeric values." Here is the code for the calculate button [code...]
View 27 Replies
May 10, 2011
To do is stop the last line, begvalue = begvalue - depreciation, from showing up in the listbox. I tried an if statement but that doesn't work
Depreciation to a Salvage Value of 0. 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 1/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:
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. Displays a depreciation schedule for the item similar to the schedule shown in Figure 6.23. Figure 6.23. Depreciation schedule for Programming Project 7. [URL]
This is the code I have so far:
Dim yearpurchased, cost, life, depreciation, begvalue, total As Double
Dim item As String
[CODE].........................
I need to get the last two numbers on the bottom right of the table.
View 11 Replies
Apr 11, 2011
This is for Visual Basic 2010 - Depreciation to a Salvage Value of 0.
Below is my code:
Public Class Form1
Dim dblCost, dblLife, dblYear, DblDepreciation, dblBegValue, dblEndValue, dblTotal, Counter
Private Sub lstOutput_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
[Code] .....
I keep getting the error at
Private Function txtCost() As Object
Throw New NotImplementedException
End Function
that NonImplementedException Unhandled.
View 1 Replies
Mar 30, 2009
I am trying to calculate the number of years for my calculate age event handler, however i am apparently missing a method or whatnot because im trying to calculate the age , can anyone suggest help on this. I need to subtract years to get my age but when i try the birthdate.Subtract (currentDate) method i get an error about not able to convert from LONG?
So below is what I have.
Private Sub btnCalculateAge_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateAge.Click
Dim currentDate As Date
Dim BirthDate As Date
Dim Age As Long
[CODE]
View 7 Replies
Jan 3, 2012
I have a picture in my picturebox. In that picture, I need to draw a straight line between two points and calculate the length of that line (probably in pixels). Is there any suggestion how to do it?
View 2 Replies
Apr 10, 2011
Any advice on using the financial.ddb function? I need to display a depreciation schedule in a label using only the financial.ddb function. I am able to show the final depreciated value at the end of the period but I don't know how to show the value for each year in the period. For example, if the user entered an asset cost of £1,000, a useful life of 4 years and a salvage value of $100 it should display: [code]
View 1 Replies
Apr 14, 2011
I need to write a program that calculates and displays the depreciation of a businesses assets.I need the program to read a comma-delimited input file containing the names of multiple assets, their purchase prices, the years of their purchase and the number of years that the assets are expected to be useful.I need to use this straight line depreciation formula- (purchase price / number of years of usefulness) * (current year �purchase year)
View 7 Replies
Apr 28, 2011
I am trying to figure out how to calculate the number of years it takes to double a user defined number. I have tried to take the number entered and multiply it by twelev and divide by two.
View 2 Replies
Mar 3, 2010
I certainly hope I don't aggravate you with what is certainly a very simple code problem. I have never programmed before, but I do have a background in tech support, etc. I have an assignment to do and it's frustrating to wade through the information out there to find exactly what I need and nothing more.The assignment has 3 parts, one of which i've done. We are to do the same function in both javascript and VB. I was able to take a sample we did in class that caluclates a 10% discount and modify it so it calculates the total. Now, I have to modify that into a VB sln file. then write about the differences but that part will be cake.
I am working in Visual Studio 2008 - that program is new to me as well. When I created my login and it asked what VB I'm using, I did not know but under theu of VS, it says VB 2008.hat I attempted to do was to take the instructor's sample discount code and modify it for the new purpose, but an error was generated. This is the sample code I started with:
'Programmer: Dan Dougherty
'Date: Feb 2010
'
[code].....
View 14 Replies
Sep 23, 2010
The program I am working on uses arrays and a text file. In one section of the program it's suppose to display the most active year for storms between the years 1990-2008. The year that has the most active storms is 2005, but I don't know how to write it in the code so that it displays. Attached is the text file.
So far I have a For Next loop that counts the arrays.
Public Class frmHurricanes
' Class Level Variables
Public Shared _intSizeOfArray As Integer = 18
[CODE]...
View 6 Replies
May 27, 2010
I am trying to calculate a total cost from an elapsed time. Dependant on how long the time is, this will calculate the total cost. It has to be 3 to every hour. The elapsed time is displayed in label6 in "hh:MM:ss" format and the total cost needs to be displayed in label8.
View 4 Replies
Jun 21, 2010
I have a class assignment where i have to calculate the total cost of a parking garage from hours but i have to do it with a method function. So this might be a stupid question but can you read the user input values from a textbox in the function itself or do they have to be read in and recalled from the Private Sub Button1_Click section?
View 8 Replies
Feb 19, 2012
I'm trying to calculate the total cost for gas for a Chevy and a Buick on a form. The total miles is 21 for city and 33 for freeway. I'm also putting in the mpg for each, for city and freeway. How would I set up the labels to display the right amount? Do I use If Then statements?
View 9 Replies
Jul 10, 2011
How to get difference between two dates in Year/Month/Week/Day?
How do i calculate exact difference between to date including years, days, moths, weeks. Just like windows calculator does. ?
And represent like this 1 years, 1 months, 1 week, 1 day
View 3 Replies
Sep 17, 2010
I am running into trouble with some code I am doing for an assignment. The section within the apostrophes (If Then Else) is the section that I am having trouble with. When the user selects a seat type and then clicks the compute button, the wrong cost is displayed instead of an accurate cost.
Option Strict On
Public Class frmTickets
Private Sub btnComputeCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnComputeCost.Click
Dim intNumberOfTickets As Integer
[CODE]....................
View 6 Replies
Jun 12, 2011
I'm in this proyect where I need an area in the form where I can place just dots, then join these dots with an straight line between them.how can I do that? I placed a Picturebox to see functions there but nothing is clear.
View 3 Replies
Jan 24, 2010
I have a line shape which I am using as a straight 'finishing line'. As the program runs an identically shaped line shape appears. I am a little confused from where and how it is appearing, as I only have the one line shape. Also, on some runs of the program 'trails' of the cars that are racing across the screen remain.Are these issues something simple I can fix?
View 5 Replies
Jul 22, 2010
[Code]...
If someone could post some sample code, in either c# or vb.net that would be much appreciated.
View 1 Replies
Oct 27, 2009
This is my project for class and this is what i have so far but my teacher gave me no credit. What am i doing wrong? i tried rearranging it but no success.
A fast-food vendor sells pizza slices at $1.25 each, fries at $1.00, and soft drinks at $0.75. Write a program to computer a customers bill. The program should use 4 subprocedures that do the following:
1. read in the amount of each item ordered
2. calculate the total cost
3. display an itemized bill
4. read in the users full name from a textbox, and display a sentence, addressing the user by first name only and in upper case characters, informing the user of their bill
Here is an example itemized bill:
Item Quantity Price
Pizza slices 3 $1.25
Fries 4 $1
Soft drinks 5 $0.75
Total $11.50
Example sentence for point 4: if the user name was entered as John Smith, you would display the sentence JOHN, your bill is $11.50.
MY
Public Class Form1
Sub pizza(ByVal pizzap As Double, ByVal pizzanum As Double)
lstoutput.Items.Add("Pizza Slices" & pizzap & "and" & pizzanum & "is" & (pizzap * pizzanum) & ".")
[CODE]....
View 6 Replies
Jul 22, 2010
I have two points (x1, y1) and (x2,y2) and have a straight line between the 2 points, from this I can work out the distance between the 2 points lets say it is 50.What I want to do is increase or decrease the length of the line by a predefined amount lets say 10.So If I increase the line length by 10 (from 50 to 60), What I want to work out is what point(x3,y3) would be at the end of the increased line.Hope this makes sense.I have tried to work out the new point using the angle but it does not work correctly, it does not seems to produce a perfectly straight line and the angle from point (x1,y1) to the new (x3,y3) is not the same as the angle from point (x1,y1 to x2,y2).
This is what I have tried:
:I work out the angle
aAngle =Math.Atan((Y2 Y1) / (X2 X2))
[code].....
View 1 Replies
May 29, 2012
I use this cod but it not moving the text contnusly Private sub Timer1............ Label1.text = " " & Label1.text
View 1 Replies
Aug 16, 2010
Under the MouseLeftButtonUp event handker store the first coordinates of the lines second endpoint. Then call the length method to obtain the distance between the two endpoints(the lines length). Fianlly display the line on the canvas and the line's length in the Length=Label. Below is the code I have so far. There are no errors, but when I run the application nothing happens.
Private Sub lineCanvas_MouseLeftButtonUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArg... Handles lineCanvas.MouseLeftButtonUp
Dim distance As Double
endPoint = e.GetPosition(lineCanvas)
[Code].....
View 2 Replies
May 8, 2011
I am developing a program where i will download and save an xml file from a url as abc.xml. I open the abc.xml in a datagridview with a dataset without problem.I am confused how can i read raw per raw the datagridview and assign the data in a database table? i am using vb 2008 + msde2005 express.I show the whole content of the xml file in the datagridview with the following [code]I dont know how to create a loop where i can read the datagridview line by line save data in variables (ex.strings) and save it in a databese table?
View 6 Replies
May 5, 2009
I have a class project that I have been working on for a while, and I can't figure out how to add each cost from lstCosts together to show a total cost of the selected workshops in lblTotalCost. Using the current loop that I have, it only adds the last cost in lstCosts. Is there a way to add the indexes together?
Code:
Public Class Form1
' The registration fee for each workshop
Const intSTRESS As Integer = 595 ' handling stress
Const intMANAGEMENT As Integer = 695 ' time management
Const intSKILLS As Integer = 995 ' supervision skills
[Code] .....
View 1 Replies
Oct 25, 2009
I need to change it so that this contains a loop to calculate the earnings.
vb.net
Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
'Compute total earnings at retirement.
'get 5% raise per year, retire at age 65.
Dim name As String, age As Integer, salary As Double
[Code] .....
View 4 Replies
Feb 23, 2012
Using the attached code, the goal is to draw a series of 1x1 rectangles to produce an image of a line. The image begins okay at point (0,0) but ends up after 5600 passes through the loop at (1884,5273) instead of at (1965, 5244). To prove the scale factor accurate I also use Drawline to draw the entire line with the same scale factor. Drawline ends up at the correct location (1965,5244).
I've manually checked the calculations with the results as noted. I'm at a total loss to understand what's going on.
' Xc = 1965
' Xp = 0
' Yc = 5244
[Code]....
View 2 Replies
Dec 23, 2010
I want to get the total years and months in a number eg. 25 should give me 2 years 1 month. and 11 should give me 0 years 11 months and maybe 12 should be 1 year 0 months,i have this code but it does work for me as i want it seems the loop i am using goes only once.
Dim Month As Double = 25
Dim LeftMonth As Double
Dim Count As Integer = 0
[Code].....
View 3 Replies
Jun 10, 2011
program that allows the user to enter a month and a number of years. (e.g March and 10 years) The program then displays all the months of the year from the entered month in a loop that runs as many times as the number of years.(e.g March April May.....December January February March....)
View 1 Replies
Aug 5, 2009
I am attempting to calculate the number of months between 2 dates in vb 2008. Effectively subtracting a date in the past from the current date and then manipulating it to the number of months between the two.
I have done this in VB 6 previously, but can't seem to do it in vb2008.
View 7 Replies