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
How can i learn about networks
timama [110]

Answer:

1. Clients and servers—how services such as e-mail and web pages connect using networks.

2. IP addresses—how devices on a network can be found.

3. Network hubs, switches and cables—the hardware building blocks of any network.

4. Routers and firewalls—how to organize and control the flow of traffic on a network.

3 0
3 years ago
A software is made from​
andriy [413]

Answer:

Two or more languages are used for making one particular software.

5 0
2 years ago
How did Bill Gates benefit from free enterprise? Need a paragraph please. Will give the branliest!!
olchik [2.2K]

Answer:

Bill Gates used his skills and brains to build a business. In conclusion, Bill Gates was very successful with his industry thanks to free enterprise. He, along with his employees and friends, created and almost perfected the software known as Microsoft. The free enterprise system provides the right to private enterprise, which allowed him to choose his own business and to run it without governmental influence. Because he could create his own business and design his own products, Gates was able to specialize in technology.

Explanation:

8 0
2 years ago
How do u create a blank line between two lines in a document
Free_Kalibri [48]

Answer: Press enter at the end of the line.

Explanation:

If you press enter at the end of the line or sentence, it will start a new space underneath your line or sentence.

8 0
3 years ago
In 2016, NIST published a new Federal Master Cybersecurity Framework to create a mandatory framework for managing cybersecurity
ICE Princess25 [194]

Answer:

In 2014, NIST published a new Federal Master Cybersecurity Framework for managing cyber risk for the delivery of critical services. So the correct answer is False.

Explanation:

NIST published the Federal Master Cybersecurity Framework to managing risk for the delivery of critical services. The U.S. issued Framework on February 12, 2014.

8 0
3 years ago
Other questions:
  • You browsing internet and you realize that its not responding what do you do with out rebooting the computer
    10·1 answer
  • To type the letter address, _________ space from the dateline
    9·2 answers
  • Crashing almost always accelerates the schedule while increasing project risk, whereas fast tracking almost always accelerates t
    10·1 answer
  • Technically
    12·1 answer
  • What is the best definition of the 7x7 rule for maximizing audience comprehension
    13·1 answer
  • When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the accoun
    10·1 answer
  • What is the model for 2017 Ford Mustang v6
    15·1 answer
  • Which of the following guidelines about the subject line of e-mail messages is most appropriate?
    15·2 answers
  • If 2 people use my code D9R2M on fetch reward and scan receipts I will give brainliest ​
    13·2 answers
  • A(n) _______________ is a network organization that centralizes user accounts, passwords, and access to resources.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!