Question: Purpose: Solve a problem by writing maltiple functions that perform different subuasks and combining those functions to solve a larger problem. Also, to practice documenting

 Purpose: Solve a problem by writing maltiple functions that perform different

Purpose: Solve a problem by writing maltiple functions that perform different subuasks and combining those functions to solve a larger problem. Also, to practice documenting functions. Degree of Difficalty: Moderate Your task is to compute the cost of renovating the flooring in a rectangular room - specifically. the cost of replacing the carpet and the baseboards. Your ask is to write a Python program that calculates and the cost of these renovations. Your program must use three Python functions: carpetid. bascboardo and costo. The baseboanto functioe has two parameters; wilh (the width of the foom in foet) and lengrh(length of the room in feet). The function asks the user for the cost of baseboard per linear foot and returns the total cost of the baseboard. The total cost of baseboard is determined using the formula perimeter x cost of basebeard per foot. The perimeter of the room is: perimeter2width+2length. The carpeto function should take two parameters: whith (the width of the roons in feet) and lewgth (length of the room in feet). The fusction asks the user for the cost of carpet per square foot and returns the total cost of the carpet using the formula is ara cost of carpet per square foot. The area of the room is: areawidthlength. The function cano 0 determines and returns the value of the total cost of the renovation project. The total cost of the project is the cost of materials plus $500 labor. Function costef should call the functions hasehoard 0 and carpet 0 , and use their return values as the cost of the baseboard and carpet materials respectively. The parameters of the costl function should be chosen so that they provide the information required to call the haseboand O and carpeto functions. You must also write a "main" program to test your functions. This programn will ask for the room dimensions, call cost to deternaine the total renovation cost, and display the total renovation cost in a meaningful message to the user. Test your program with three sets of input (width, length, baseboard cost/oot, and carpet cost per square foot). Calculate the total renovation cost (by hand of using a calculator) for each set of inpats in advance so that you can jodge whether your program is correct. Run you program 3 times - oace for each set of inputs. Copy the console output from each of your three testing examples into al text file and hand that text file in along with your program files (see "What to Hand In", below). See a sample run on the next page. Note, You may assume that the user will always provide valid input from the console, In other words, your program does net have to do any error checking for data input. Remember, that all data input from the console is of the data type string. Remember to write appropriate docstrings for each function that states the function purpose, ats parameter(s) and is return value(s). Note. This program could be written without writing 3 functions. However, the purpose of the askignmenl is to provide you peactice creating and calling functions. Solutions that do not use the 3 furctions outlined above will not get full marks. UNIVERSITY OF SASKATCIIEWAN Sample Run Here is an example of how your program's console output might look for one set of data. Green text was entered by the oser, blue text came from data returned by the function. What in the vidth of the roon iftel is What in the insect of the roos itte) inpot the ocet lit. I ilacer foot if basobasia (3)? trpot the oout of a sepase taet of earpet (3)id ror a rive of width 20.0 and length 20.9 the cont of the rete is 1.522.1

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!