Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3.0 via PyCharm Purpose: Solve a problem by writing multiple functions that perform different subtasks, and combining their use to solve a larger problem.

Python 3.0 via PyCharm

image text in transcribedimage text in transcribed

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 ength 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 width + 2 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 x length and the total cost of the carpetis area x cost of carpet per square fooit 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago