Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Visual Basic program help. Project Specifications: Depreciation to a Salvage Value of 0. For tax purposes an item may be depreciated over a period of

Visual Basic program help.

Project Specifications: 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 1th of its original value. With the doubledeclining-balance method of depreciation, each year the item depreciates by 2ths of its value at the beginning of that year. (In the final year it is depreciated by its value at the beginning of the year.) Write a program that performs the following tasks:

(A) Request a description of the item, the year puchased, the cost of the item, the number of years to be dpreciated (estimated life), and the method of depreciation. The method of depreciation should be chosen by clicking on one of two buttons.

(B) Validate all the data and produce the following error messages: "Must enter a Description." "Year Purchased is not numeric." "Year Purchased is not between 1900 and 9999" "Purchase Amount is not numeric." "Purchase Amount must be > zero." "Years to Depreciate is not numeric." "Number of years must be between 1 and 999." (

(C) Displays the year-by-year depreciation similar to examples below.

(D) The Restart button will reset program to accept new data.

I have attached the code I have completed so far but I still need code for the section in the code where it is commented, "Edit other data: Amount, NumberOfYears"

I have also attached the sample output with the forms.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Sample output:

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Thanks and please try and use simple code, nothing too complex.

DK File Edit View Git Tools Extensions Window Help Search Cult) DemoW...ursday Sign in Project Build Debug Test Analyze 2.- Debug Debug - Any CPU DemoWeekG_Thursday @ Live Share Toolbox Solution Explorer 2 - + Search Toolbox General There are no usable controls in this group. Drag an item onto this text to add it to the toolbox **** Date Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb ***** TrDisplay.vb) [Design] [ FrmDemo Weck6_Thursday.vb (Designl' Frm Demo Week6 Thursday.vb* + x VB Demo Week6 Thursday FrmDemo Week6 Thursday - conENTRY DESCRIPTION 1 reference 1 Public Class FrmDemoWeek 6_Thursday 2 ************************ ********************* ************* 3 **** Program: Depreciation to a Salvage Value of @ 4 *** Author : 5 : 6 6 7 'class level variables and constants Const CONENTRY_DESCRIPTION AS String = 9 "" 1e Const conENTRY_YEARPUR As String = 11 " " 14 Const conENTRY_NUMYEARS As String = 15 " conoK Then 81 MsgBox(Stret) 82 TxtYrPur. Focus() 83 Exit Sub 84 End If 85 Edit thor at Amunt Membannfore 100% No issues found Ln: 8 Ch: 41 SPC CRL Solution Explorer Git Changes Properties Server Explorer Toolbox O Ready I Type here to search + Add to Source Control 3:00 PM 2/28/2021 O DK File Edit View Git Tools Extensions Window Help Search (Culto DemoW...ursday Sign in Project Build Debug Test Analyze 2.- Debug Debug - Any CPU - DemoWeekG_Thursday - 0,5 = ?: Live Share Toolbox Solution Explorer 2 + Search Toolbox General There are no usable controls in this group. Drag an item onto this text to add it to the toolbox Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb CrmDisplay.vb [Design] fomDemo Weck6_Thursday.vb (Design Frm Demo Week6_Thursday.vb* + x VB Demo Week6 Thursday FrmDemo Week6 Thursday - conENTRY DESCRIPTION EXIL SUD 84 End If 85 86 'Edit other data: Amount, Number of years 87 88 'Function: StrReport = BuildReport(4 items) 89 Str Report = BuildRpt(strDescr, IntYearPur, ge DblAmount, IntNumYears) 91 92 Display the StrReport 93 Call DispRpt(StrReport) 94 95 96 End Sub 97 1 reference 98 Private Function BuildRpt(ByVal Strbesc As String, 99 ByVal InterPur As Integer, 100 Byval DblAmt As Double, 101 ByVal Int Numyrs As Integer). 182 As String 103 'Building the report 184 Dim strout As String 105 Dim dblCurDepr As Double 106 Dim dblEndDepr As Double 107 Dim dblstartval As Double 108 109 Dim StrFormat As String = "{@,-9]{1,13}{2,13}(3,13}" 110 111 112 'Calculate the amounts 100% - No issues found Ln: 8 Ch: 41 Solution Explorer Git Changes Properties Server Explorer Toolbox SPC CRL O Ready I Type here to search + Add to Source Control 3:01 PM 2/28/2021 O DK File Edit View Git Tools Extensions Window Help Search (Cul+Q) DemoW...ursday Sign in Project Build Debug Test Analyze 2.- Debug Debug - Any CPU DemoWeek6_Thursday - Live Share Toolbox Solution Explorer FrDisplay.vb [Design VB Demo Week6 Thursday FrmDemo Week6_Thursday.vb Designi" Frm Demo Week_Thursday.vb* + + X FrmDemo Week6 Thursday ..conENTRY DESCRIPTION ---- + Search Toolbox General 'Calculate the amounts There are no usable controls in this group. Drag an item onto this text to add it to the toolbox 1 2 3 5 '12345678901234567890123456789012345678901234567890 Value at Amount Deprec Total Depreciation "Year beg of Yr During Year to End of Year Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb 110 111 112 113 114 115 116 117 118 119 12e 121 122 123 124 125 126 127 128 129 130 strout = "Date/Time of Report" & Now & vbCrLf & vbCrlf strout &= "Description ;" & StrDesc& vbCrLf & vbCrlf strout &=" Value at Amount Deprec Total Depreciation" & vbCrlf strout &= "Year beg of Yr During Year to End of Year" & vbCrlf 'In a loop to show each year. strout &= String.Format(strFormat, Intyrpur, dblstartval, dblCurDepr, dblendDepr) & vbCrlf Return strout Solution Explorer Git Changes Properties End Function 1 reference Private Sub DispRpt(ByVal StrReport As String) Displays the report Dim frmDisp As New FrmDisplay 131 132 133 134 135 136 137 138 100% - % frmDisp. TxtOut.Text = StrReport frmDisp.ShowDialog() Server Explorer Toolbox End Sub No issues found Ln: 8 Ch: 41 SPC CRL O Ready + Add to Source Control 3:01 PM 2/28/2021 H Type here to search O DK File Edit View Git DemoW...ursday Sign in Live Share Project Build Debug Test Analyze Tools Extensions Window Help Search (Cul+Q) - Debug Debug - Any CPU - DemoWeekG_Thursday 0,1 = ? FrmDisplay.vb (Design) FmDemowock6_Thursday.vb) [Design Frm Demo Week6_Thursday.vb* + x VB Demo Week6 Thursday FrmDemoWeek6 Thursday ..conENTRY DESCRIPTION Toolbox Solution Explorer - + Search Toolbox General 139 There are no usable controls in this group. Drag an item onto this text to add it to the toolbox 1 reference Private Function chkyrpur(Byval StrText As String, By Ref IntYearPur As Integer) As String "Validate the Year purchased Dim Stret As String = conOK Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 If Str Text = "" Or StrText = conENTRY_YEARPUR Then Stret = conERROR_MISSING_YEARPUR Else If Integer. TryParse(StrText, IntYearPur) = False Then Stret = conERROR_INVALID_NUMERIC & conENTRY_YEARPUR End If End If Return Stret Solution Explorer Git Changes Properties End Function O references Private Sub LblDesc_Click(sender As Object, e As EventArgs) Handles LblDesc.click 158 159 168 161 162 End Sub End Class Server Explorer Toolbox 100 % - No issues found Ln: 8 Ch: 41 SPC CRL O Ready I Type here to search + Add to Source Control 3:01 PM 2/28/2021 O Project3: Depreciation to a Salvage Value of Zero Depreciation to a Salvage Value of Zero Description: KEnter Item Description Year Purchased: Purchase Amount: Years to Depreciate Enter Number of Years> Over: Select a Depreciation Method Straight-line Method (1) Double-declining Method (2) Show Calculation ReStart Close Project3: Depreciation to a Salvage Value of Zero OX Depreciation to a Salvage Value of Zero Description: Car Year Purchased: 2000 Purchase Amount: 20000 Years to Depreciate Over: 51 Select a Depreciation Method Straight-line Method (1) Double-declining Method (2) Show Calculation ReStart Close New form is displayed to show depreciation. (This could be shown on original form without losing any points) Depreciation Schedule pate/Time of Report :8/22/2017 11:27:40 AM Description : Car Year of purchase : 2000 Cost : $20,000.00 Estimated Life : 5 Method of depreciation: straight-line-balance Value at beg of Yr Amount Deprec During Year Total Depreciation to End of Year Year 2000 2001 2002 2003 2004 $20,000.00 $16,000.00 $12,000.00 $8,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $8,000.00 $12,000.00 $16,000.00 $20,000.00 Close Using the same data, selecting double-declining-balance and hitting Show Calculate displays this form: Depreciation Schedule Date/Time of Report : 8/22/2017 11:29:22 AM Description : Car Year of purchase : 2000 Cost : $20,000.00 Estimated Life : 5 Method of depreciation: double-declining-balance Value at beg of Yr Amount Deprec During Year Total Depreciation to End of Year Year 2000 2001 2002 2003 2004 $20,000.00 $12,000.00 $ 7,200.00 $4,320.00 $2,592.00 $8,000.00 $4,800.00 $2,880.00 $1,728.00 $2,592.00 $8,000.00 $12,800.00 $15, 680.00 $17,408.00 $20,000.00 Close DK File Edit View Git Tools Extensions Window Help Search Cult) DemoW...ursday Sign in Project Build Debug Test Analyze 2.- Debug Debug - Any CPU DemoWeekG_Thursday @ Live Share Toolbox Solution Explorer 2 - + Search Toolbox General There are no usable controls in this group. Drag an item onto this text to add it to the toolbox **** Date Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb ***** TrDisplay.vb) [Design] [ FrmDemo Weck6_Thursday.vb (Designl' Frm Demo Week6 Thursday.vb* + x VB Demo Week6 Thursday FrmDemo Week6 Thursday - conENTRY DESCRIPTION 1 reference 1 Public Class FrmDemoWeek 6_Thursday 2 ************************ ********************* ************* 3 **** Program: Depreciation to a Salvage Value of @ 4 *** Author : 5 : 6 6 7 'class level variables and constants Const CONENTRY_DESCRIPTION AS String = 9 "" 1e Const conENTRY_YEARPUR As String = 11 " " 14 Const conENTRY_NUMYEARS As String = 15 " conoK Then 81 MsgBox(Stret) 82 TxtYrPur. Focus() 83 Exit Sub 84 End If 85 Edit thor at Amunt Membannfore 100% No issues found Ln: 8 Ch: 41 SPC CRL Solution Explorer Git Changes Properties Server Explorer Toolbox O Ready I Type here to search + Add to Source Control 3:00 PM 2/28/2021 O DK File Edit View Git Tools Extensions Window Help Search (Culto DemoW...ursday Sign in Project Build Debug Test Analyze 2.- Debug Debug - Any CPU - DemoWeekG_Thursday - 0,5 = ?: Live Share Toolbox Solution Explorer 2 + Search Toolbox General There are no usable controls in this group. Drag an item onto this text to add it to the toolbox Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb CrmDisplay.vb [Design] fomDemo Weck6_Thursday.vb (Design Frm Demo Week6_Thursday.vb* + x VB Demo Week6 Thursday FrmDemo Week6 Thursday - conENTRY DESCRIPTION EXIL SUD 84 End If 85 86 'Edit other data: Amount, Number of years 87 88 'Function: StrReport = BuildReport(4 items) 89 Str Report = BuildRpt(strDescr, IntYearPur, ge DblAmount, IntNumYears) 91 92 Display the StrReport 93 Call DispRpt(StrReport) 94 95 96 End Sub 97 1 reference 98 Private Function BuildRpt(ByVal Strbesc As String, 99 ByVal InterPur As Integer, 100 Byval DblAmt As Double, 101 ByVal Int Numyrs As Integer). 182 As String 103 'Building the report 184 Dim strout As String 105 Dim dblCurDepr As Double 106 Dim dblEndDepr As Double 107 Dim dblstartval As Double 108 109 Dim StrFormat As String = "{@,-9]{1,13}{2,13}(3,13}" 110 111 112 'Calculate the amounts 100% - No issues found Ln: 8 Ch: 41 Solution Explorer Git Changes Properties Server Explorer Toolbox SPC CRL O Ready I Type here to search + Add to Source Control 3:01 PM 2/28/2021 O DK File Edit View Git Tools Extensions Window Help Search (Cul+Q) DemoW...ursday Sign in Project Build Debug Test Analyze 2.- Debug Debug - Any CPU DemoWeek6_Thursday - Live Share Toolbox Solution Explorer FrDisplay.vb [Design VB Demo Week6 Thursday FrmDemo Week6_Thursday.vb Designi" Frm Demo Week_Thursday.vb* + + X FrmDemo Week6 Thursday ..conENTRY DESCRIPTION ---- + Search Toolbox General 'Calculate the amounts There are no usable controls in this group. Drag an item onto this text to add it to the toolbox 1 2 3 5 '12345678901234567890123456789012345678901234567890 Value at Amount Deprec Total Depreciation "Year beg of Yr During Year to End of Year Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb 110 111 112 113 114 115 116 117 118 119 12e 121 122 123 124 125 126 127 128 129 130 strout = "Date/Time of Report" & Now & vbCrLf & vbCrlf strout &= "Description ;" & StrDesc& vbCrLf & vbCrlf strout &=" Value at Amount Deprec Total Depreciation" & vbCrlf strout &= "Year beg of Yr During Year to End of Year" & vbCrlf 'In a loop to show each year. strout &= String.Format(strFormat, Intyrpur, dblstartval, dblCurDepr, dblendDepr) & vbCrlf Return strout Solution Explorer Git Changes Properties End Function 1 reference Private Sub DispRpt(ByVal StrReport As String) Displays the report Dim frmDisp As New FrmDisplay 131 132 133 134 135 136 137 138 100% - % frmDisp. TxtOut.Text = StrReport frmDisp.ShowDialog() Server Explorer Toolbox End Sub No issues found Ln: 8 Ch: 41 SPC CRL O Ready + Add to Source Control 3:01 PM 2/28/2021 H Type here to search O DK File Edit View Git DemoW...ursday Sign in Live Share Project Build Debug Test Analyze Tools Extensions Window Help Search (Cul+Q) - Debug Debug - Any CPU - DemoWeekG_Thursday 0,1 = ? FrmDisplay.vb (Design) FmDemowock6_Thursday.vb) [Design Frm Demo Week6_Thursday.vb* + x VB Demo Week6 Thursday FrmDemoWeek6 Thursday ..conENTRY DESCRIPTION Toolbox Solution Explorer - + Search Toolbox General 139 There are no usable controls in this group. Drag an item onto this text to add it to the toolbox 1 reference Private Function chkyrpur(Byval StrText As String, By Ref IntYearPur As Integer) As String "Validate the Year purchased Dim Stret As String = conOK Search Solution Explorer (Ctrl+:1 y Solution 'Demo Week6_Thursday' (1 of |VBDemoWeek6 Thursday D Dependencies My Project D VB ApplicationEvents.vb DE FrmDemo Week6_Thursday.vb D ErmDisplay.vb 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 If Str Text = "" Or StrText = conENTRY_YEARPUR Then Stret = conERROR_MISSING_YEARPUR Else If Integer. TryParse(StrText, IntYearPur) = False Then Stret = conERROR_INVALID_NUMERIC & conENTRY_YEARPUR End If End If Return Stret Solution Explorer Git Changes Properties End Function O references Private Sub LblDesc_Click(sender As Object, e As EventArgs) Handles LblDesc.click 158 159 168 161 162 End Sub End Class Server Explorer Toolbox 100 % - No issues found Ln: 8 Ch: 41 SPC CRL O Ready I Type here to search + Add to Source Control 3:01 PM 2/28/2021 O Project3: Depreciation to a Salvage Value of Zero Depreciation to a Salvage Value of Zero Description: KEnter Item Description Year Purchased: Purchase Amount: Years to Depreciate Enter Number of Years> Over: Select a Depreciation Method Straight-line Method (1) Double-declining Method (2) Show Calculation ReStart Close Project3: Depreciation to a Salvage Value of Zero OX Depreciation to a Salvage Value of Zero Description: Car Year Purchased: 2000 Purchase Amount: 20000 Years to Depreciate Over: 51 Select a Depreciation Method Straight-line Method (1) Double-declining Method (2) Show Calculation ReStart Close New form is displayed to show depreciation. (This could be shown on original form without losing any points) Depreciation Schedule pate/Time of Report :8/22/2017 11:27:40 AM Description : Car Year of purchase : 2000 Cost : $20,000.00 Estimated Life : 5 Method of depreciation: straight-line-balance Value at beg of Yr Amount Deprec During Year Total Depreciation to End of Year Year 2000 2001 2002 2003 2004 $20,000.00 $16,000.00 $12,000.00 $8,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $4,000.00 $8,000.00 $12,000.00 $16,000.00 $20,000.00 Close Using the same data, selecting double-declining-balance and hitting Show Calculate displays this form: Depreciation Schedule Date/Time of Report : 8/22/2017 11:29:22 AM Description : Car Year of purchase : 2000 Cost : $20,000.00 Estimated Life : 5 Method of depreciation: double-declining-balance Value at beg of Yr Amount Deprec During Year Total Depreciation to End of Year Year 2000 2001 2002 2003 2004 $20,000.00 $12,000.00 $ 7,200.00 $4,320.00 $2,592.00 $8,000.00 $4,800.00 $2,880.00 $1,728.00 $2,592.00 $8,000.00 $12,800.00 $15, 680.00 $17,408.00 $20,000.00 Close

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions