Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

program language: python 3

image 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 (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

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

Logic In Databases International Workshop Lid 96 San Miniato Italy July 1 2 1996 Proceedings Lncs 1154

Authors: Dino Pedreschi ,Carlo Zaniolo

1st Edition

3540618147, 978-3540618140

More Books

Students also viewed these Databases questions

Question

=+3. What benefits can you offer this public?

Answered: 1 week ago