1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
brilliants [131]
2 years ago
10

Create a Python program that computes the cost of carpeting a room. Your program should prompt the user for the width and length

in feet of the room and the quality of carpet to be used. A choice between three grades of carpet should be given. You should decide on the price per square foot of the three grades on carpet. Your program must include a function that accepts the length, width, and carpet quality as parameters and returns the cost of carpeting that room. After calling that function, your program should then output the carpeting cost. of carpeting a room. Note: the output is NOT in the function but in the main. Display your name,class,date as per SubmissionRequirements by using a function.
Your program should include your design steps as your comments. Document the values you chose for the prices per square foot of the three grades of carpet in your comments as well.
Computers and Technology
1 answer:
allochka39001 [22]2 years ago
8 0

Answer:

In Python:

def calcCost(length,width,quality):

   if quality == 1:

       cost = length * width * 3.50

   if quality == 2:

       cost = length * width * 2.50

   else:

       cost = length * width * 1.50

   

   return cost

   

length = float(input("Room Length: "))

width = float(input("Room Width: "))

print("Quality:\n1 - Best\n2 - Moderate\n3 and others - Worst")

quality = int(input("Quality: "))

print("Calculate: "+str(calcCost(length,width,quality)))

Explanation:

This defines the function calcCost to calculate the carpeting cost

def calcCost(length,width,quality):

If quality is 1, the total cost is calculated by area * 3.50

<em>    if quality == 1:</em>

<em>        cost = length * width * 3.50</em>

If quality is 2, the total cost is calculated by area * 2.50

<em>    if quality == 2:</em>

<em>        cost = length * width * 2.50</em>

For other values of quality, the total cost is calculated by area * 1.50

<em>    else:</em>

<em>        cost = length * width * 1.50</em>

This returns the calculated carpeting cost    

   return cost

   

The main begins here

This prompts the user for the length of the room

length = float(input("Room Length: "))

This prompts the user for the width of the room

width = float(input("Room Width: "))

This gives instruction on how to select quality

print("Quality:\n1 - Best\n2 - Moderate\n3 and others - Worst")

This prompts the user for the quality of the carpet

quality = int(input("Quality: "))

This calls the calcCost method and also printst the calculated carpeting cost

print("Calculate: "+str(calcCost(length,width,quality)))

You might be interested in
I NEED A BIG BRAIN BOYO TO HELP ME
dlinn [17]
Yoooo whattt?? I don’t get this but idek
7 0
3 years ago
Tech A says that no matter which way the vehicle turns, the inside wheel must always turn less sharply than the outside wheel. T
vodomira [7]
The answer is c because the perpendicular bicector alligns.
5 0
2 years ago
How do I write this code in java? input "Enter Your Age to Order a Beer"
Klio2033 [76]

Answer:

i dont know sorry but answer above lol

Explanation:

5 0
3 years ago
Which tools do you use for LinkedIn automation?
borishaifa [10]
<h2>Explanation:</h2>

Automation tools allow applications, businesses, teams or organizations to automate their processes which could be deployment, execution, testing, validation and so on. Automation tools help increase the speed at which processes are being handled with the main aim of reducing human intervention.

Linkedln automation tools are designed to help automate certain processes in Linkedln such as sending broadcast messages, connection requests, page following and other processes with less or no human or manual efforts. Some of these automation tools include;

i. <em>Sales navigator</em> for finding right prospects thereby helping to build and establish trusting relationships with these prospects.

ii. <em>Crystal </em>for providing insights and information about a specified Linkedln profile.

iii. <em>Dripify </em>used by managers<em> </em>for quick onboarding of new team members, assignment of roles and rights and even management of subscription plans.  

6 0
3 years ago
What are two type of physicals connection
netineya [11]
Two types of physical connection are:

A wired connection using a cable

A wireless connection using radio waves
7 0
3 years ago
Other questions:
  • Karen has opened a new business and is using Google Display Ads to build awareness of her new products. How does Google Display
    6·1 answer
  • You've been hired as a consultant to help an online store owner. You need to complete the implementation of conversion tracking
    5·1 answer
  • What does a data bar in a cell represents​
    12·2 answers
  • Blank determines the overall brightness or darkness of an entire image
    5·1 answer
  • Engineers and scientists redesign a prototype if it does not work correctly true or false and why
    10·2 answers
  • Do u have to divide or multiply this problem 5300 yd = mi
    9·1 answer
  • Is pseudocode obtained from Algorithm or is Algorithm obtained from pseudocode?
    8·1 answer
  • On the MarketingConsultants worksheet, in cells D10:H13, use a PMT function to calculate the end of the month payment amount. En
    15·1 answer
  • Explain briefly the use of the computers in the advertising area​
    11·1 answer
  • A message is sent to all hosts on a remote network. Which type of message is it?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!