1. Engineering
  2. Computer Science
  3. program language python 3...

Question: program language python 3...

Question details

program language: python 3

Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem. Also to practice documenting functions. Degree of Difficulty: Moderate Your task is to compute the cost of renovating the flooring in a rectangular room. This includes replacing the carpet and and the baseboards. Your task is to write a Python program that calculates and the cost of the renovation. To accomplish this, you will need to write three Python functions: cost, carpet, and baseboard. The baseboard function should take parameters width (the width of the room in feet) and length (length of the room in feet). The function will need to obtain the cost of baseboard per linear foot from console input. It will return the total cost of the baseboard. The permimeter of the room is: perimeter = 2 x width + 2 x length and the total cost of the baseboard is perimeter x cost of baseboard per foot The carpet function should take parameters width (the width of the room in feet) and length (length of the room in feet). The function will need to obtain the cost of carpet per square foot from console input. It will retum the total cost of the carpet. The area of the room is: areawidth x length and the total cost of the carpetis area x cost of carpet per square foot The cost function determines the total cost of the project It should call baseboard and carpet and use their return values to compute the total cost. . The total cost will be the cost of materials plus $500 labor The parameters of the cost function should be chosen so that they provide the necessary information required to call the baseboard and carpet functions. Remember to write appropriate docstrings for each function which states their purpose, parameter(s), and retum value(s) You must now test your program by preparing three examples (width, length.cost of baseboard, and cost of carpet) in advance so that you can judge whether your program is correct. Write code ask for the di mensions of the room inputs, then display the total cost of each prepared example to the console. Copy the console output from each of your three testing examples into a text file and hand that text file in (see What to Hand In, below) You may assume that the user supplies valid input from the console. See the sample run on the next page

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution