Design and develop a simple application system that computes the Depreciation Cost of Item (D) takes as input the purchase. Price of an Item (P) its expected number of year of service (S) and yearly Depreciation of the Item (Y)
Use the formula D=P-S/Y.
Note :
After the user enter the Purchase Price of an item (P) its expected number of year of Service (S) and yearly depreciation for the item (Y) at text boxes 1,2 and 3 the user should Click button (with a compute caption) before the resulting computed value will be displayed at the text box 4
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.txtP = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.btnCalculate = New System.Windows.Forms.Button()
Me.txtS = New System.Windows.Forms.TextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.txtY = New System.Windows.Forms.TextBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.txtD = New System.Windows.Forms.TextBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'txtP
'
Me.txtP.Location = New System.Drawing.Point(253, 17)
Me.txtP.Name = "txtP"
Me.txtP.Size = New System.Drawing.Size(100, 20)
Me.txtP.TabIndex = 0
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(104, 20)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(127, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Enter price of an Item (P):"
'
'btnCalculate
'
Me.btnCalculate.Location = New System.Drawing.Point(253, 132)
Me.btnCalculate.Name = "btnCalculate"
Me.btnCalculate.Size = New System.Drawing.Size(100, 23)
Me.btnCalculate.TabIndex = 2
Me.btnCalculate.Text = "Calculate"
Me.btnCalculate.UseVisualStyleBackColor = True
'
'txtS
'
Me.txtS.Location = New System.Drawing.Point(253, 43)
Me.txtS.Name = "txtS"
Me.txtS.Size = New System.Drawing.Size(100, 20)
Me.txtS.TabIndex = 0
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(11, 46)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(220, 13)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Enter expected number of year of service (S):"
'
'txtY
'
Me.txtY.Location = New System.Drawing.Point(253, 69)
Me.txtY.Name = "txtY"
Me.txtY.Size = New System.Drawing.Size(100, 20)
Me.txtY.TabIndex = 0
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(34, 76)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(197, 13)
Me.Label3.TabIndex = 1
Me.Label3.Text = "Enter yearly Depreciation of the Item (Y):"
'
'txtD
'
Me.txtD.Location = New System.Drawing.Point(253, 95)
Me.txtD.Name = "txtD"
Me.txtD.ReadOnly = True
Me.txtD.Size = New System.Drawing.Size(100, 20)
Me.txtD.TabIndex = 0
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(66, 102)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(165, 13)
Me.Label4.TabIndex = 1
Me.Label4.Text = "The depreciation cost of Item (D):"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(391, 177)
Me.Controls.Add(Me.btnCalculate)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtD)
Me.Controls.Add(Me.txtY)
Me.Controls.Add(Me.txtS)
Me.Controls.Add(Me.txtP)
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Depreciation Cost"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents txtP As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents btnCalculate As System.Windows.Forms.Button
Friend WithEvents txtS As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtY As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents txtD As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
End Class
Public Class Form1
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim P As Double = Double.Parse(txtP.Text)
Dim S As Integer = Integer.Parse(txtS.Text)
Dim Y As Double = Double.Parse(txtY.Text)
Dim D As Double = P - S / Y
txtD.Text = D.ToString()
End Sub
End Class
Comments
Leave a comment