Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 return the total cost of the carpet. The area of the room is area= width length and the total cost of the carpetis area 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 return 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 Here is an example of how your program's console output might look. Green text was entered by the user blue text came from data returned by the function. What is the width of the room (ft) 10 What is the length of the room (ft) 20 Input the cost of a linear foot of baseboard ($)2 Input the cost of a square foot of carpet ($)10 For a room of width 10.0 and length 20.0 the cost of the reno is $ 2620.0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started