Computer science

Program Assignment
Description
Capital assets (cars and assets) are not expensed when you buy them but are depreciated over their estimated useful life (n).
With a straight-line method of depreciation each year the capital asset depreciates (1/n)th of its cost (minus salvage value
which is the value it can be sold for at the end of its useful life). Thus if an asset costs $21,000 has a salvage value of
$1,000 and a useful life of 4 years its annual depreciation is figured:
($21,000 – $1,000)/4 = $5,000 a year
Its depreciation schedule would look like this:
Book value at beginning of year 1: $21,000
Year 1 Depreciation: $5,000
Total Accumulated Depreciation: $5,000
Book value at beginning of year 2: $16,000 (Asset cost minus total accumulated depreciation)
Year 1 Depreciation: $5,000
Total Accumulated Depreciation: $10,000
Book value at beginning of year 3: $11,000 (Asset cost minus total accumulated depreciation)
Year 1 Depreciation: $5,000
Total Accumulated Depreciation: $15,000
Book value at beginning of year 4: $6,000 (Asset cost minus total accumulated depreciation)
Year 1 Depreciation: $5,000
Total Accumulated Depreciation: $20,000
At the end of year 4 the book value (Asset cost minus total accumulated depreciation) will equal salvage value
Write a program that performs the following:
1. Requests a description of a item (capital asset), the cost of the item, salvage value of the item, the year of the
purchase and the number of years to be depreciated (estimated life)
2. Display a year-by-year description of the depreciation (see form below)
Coding
Program 4 incorporates calling sub procedures within a main procedures and a Do Loop.
Calling sub procedures within a main button sub procedure is basically incorporating structured programming. In most programs
the main sub procedure calls other sub procedures (even the other sub procedures may call other sub procedures).
This program will call two sub procedures from the depreciation button click procedure. One sub procedure will be used to
input the data into variables and the other sub procedure will do the depreciation calculations (you can even be creative and
call a procedure within a sub procedure to do some of the output (the first 5 lines) but not necessary). A structure of the
program is as follows:
1. Main Depreciation Button
a. Declare variables (item, cost, salvage, year purchased and estimated life)
b. An IF statement to make sure all text box Text properties the user has entered information into.
i. If they have not they should get a message box alerting them to this
ii. If they have then the variables should be passed to a sub procedure to input the data from the Text property into the
variables
1. Sub procedure to input data from form
a. You will pass the variables (item, cost, salvage, year purchased and estimated life) to this procedure which will
then assign the text property from the text boxes and pass the variables back to the depreciation procedure
c. Sub Procedure to calculate depreciation and list output
i. The same variables (item, cost, salvage, year purchased and estimated life) will be passed to this procedure which
will be used for calculations and output
ii. There will be other variables needed inside this procedure (not passed from the main procedure but declared within
this procedure) for calculation and output
1. You will want to make sure you initialize these to a null value (0 or empty string) after declaring them for good
programming
2. Also clear the list box
iii. You will want to calculate depreciation outside of the loop (this is also explained below when discussing the loop)
iv. You will want to send the first 5 lines of output to the list box outside the loop (this is also explained below when
discussing the loop)
1. This is where you could call a sub-procedure within this procedure but, it is not necessary
v. A Do Loop will be used to figure total depreciation and for output
1. Basically the loop will run for the number of years of the estimated life and each time through the loop will add to
total depreciation
2. The depreciation will need calculated before the loop begins as well as the first five lines of output
3. An IF statement will be used for the last line of output in the Do Loop
a. Basically when the last year of estimated life equals the last time through the loop then display the last lines of
output
2. Clear procedure when the Clear button is clicked
a. This procedure is like you have done before where text boxes and list boxes Text properties are cleared
Form
A picture of the form is below. It will be graded based on how other programs were graded (proper naming and formatting).

You can be creative in writing this program. I just want to make sure you use a Do Loop and calling several procedures within
the main procedure. As long as you accomplish these 2 things and the program is error free you will be okay with grading.

 

 

© 2020 customphdthesis.com. All Rights Reserved. | Disclaimer: for assistance purposes only. These custom papers should be used with proper reference.