Question: USING PYTHON In this assignment you will create two python files. The first one will serve as a user-defined module with two functions. The other

USING PYTHON

In this assignment you will create two python files. The first one will serve as a user-defined module with two functions. The other will import the user defined module and use the functions in that module to produce some results.

The user-defined module: The module will have two functions: (i) SLD and (ii) SOYD

The SLD function returns the straight line depreciation expense for one year for an asset. This function has three parameters OriginalValue, SalvageValue and UsefulLife. This function uses these parameters and returns the depreciation expense for a year. Note: this function has only one line of code besides the code that defines the name and the parameters of the function.

The SOYD function returns the Sum-Of-Years-Digits depreciation expense for a given year for an asset. This function has four parameters - OriginalValue, SalvageValue, UsefulLife and TheYearForWhichDepreciationExpenseNeeded. The function computes the depreciation expense for the year for which the depreciation expense is needed, using the other parameters. Note: this function will have a for loop that computes the sum of the years digits based on the useful life. It will then use this information to compute the depreciation expense for the year for which the depreciation expense is needed.

Please save this file as deprModuleByLastnameFirstname.py The second file: In this file, you will first import the depr module you created above.

You will then request three pieces of data from the user: (i) the original value of the asset (accepted in a variable as float) (ii) the salvage value of the asset (accepted in another variable as float) and (iii) the useful life of the asset (accepted in another variable as integer). You will use appropriate variable names to accept these three values.

You will then print a line like this : =================================================== You will then print the following statement:

The straight line depreciation expense for every year is =

Where the value is a result of calling the SLD function of the module and passing it the three parameters values you collected from the user. For printing the above statement, please use the formatting of string using the % method. Please print the value as a float with 2 decimal places and 12 total characters.

You will then print a line like this : =================================================== You will then print as many statements as the useful life of the asset, as follows:

The sum of the years digits depreciation expense for year =

Where the value of the year, i, goes from 1 through the useful life of the asset and the is the result of calling the function SOYD of the imported module and passing four parameters: the original value, the salvage value, the useful life and i, where i goes from 1 through the useful life of the asset.

It will then print a line like this : ===================================================

You will use a for loop and the range() function to loop through 1 through the useful life of the asset and within the loop you will print the statement.

A sample output when I execute the second file is as follows:

Please enter the original value of the asset: 25000 Please enter the salvage value of the asset: 2500 Please enter the useful life of the asset: 8 ======================================================================== The straight line depreciation expense for every year = 2812.50 ========================================================================

The sum of the years digit depreciation expense for year 1 = The sum of the years digit depreciation expense for year 2 = The sum of the years digit depreciation expense for year 3 = The sum of the years digit depreciation expense for year 4 = The sum of the years digit depreciation expense for year 5 = The sum of the years digit depreciation expense for year 6 = The sum of the years digit depreciation expense for year 7 = The sum of the years digit depreciation expense for year 8 =

5000.00 4375.00 3750.00 3125.00 2500.00 1875.00 1250.00 625.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!