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
What is the purpose of the Occupational Safety and Health Act?
NikAS [45]

Answer:

The purpose of this act was to reduce workplace hazards and implement more safety and health programs for both employers and their employees.  

3 0
3 years ago
Read 2 more answers
What’s your fave tv show?
kompoz [17]

Answer:

the vampire diareas

Explanation:

7 0
2 years ago
Read 2 more answers
I need help ASAP Please! :)
amid [387]
Your parents,your school,google,your social media accounts
3 0
3 years ago
Write 8 tips for cyber safety
alina1380 [7]

Answer:

8 tips for cyber safety

1. Keep Personal Information Professional and Limited

2. Keep Your Privacy Settings On

3. Practice Safe Browsing

4. Make Sure Your Internet Connection is Secure. Use a Secure VPN Connection

5. Be Careful What You Download

6. Choose Strong Passwords

7. Make Online Purchases From Secure Sites

8. Be Careful What You Post

8 STEPS TO STOP YOUR CHILD’S CYBERBULLY

Resist The Urge To Respond Or Retaliate

Document The Bullying

Get Help

Block The Bully

Keep Passwords Secret

Be A Teammate

Approach The Parents

Support Your Child With A Stress-Free, Supportive Home

Explanation:

5 0
3 years ago
Hilda is troubleshooting a problem with the encryption of data. at which layer of the osi reference model is she working?
Fittoniya [83]
The la<span>yer of the osi reference model that hilda is currently working on is: presentation
On Osi reference model, the presentation layer is created </span><span>to take care of the semantics and syntax of the information exchanged between two systems. The presentation layer will make sure that the receiver of the information will understand the data that being given.</span>
7 0
3 years ago
Other questions:
  • Using Python
    14·1 answer
  • To select a number format, you can choose a category in the Number tab in the Format Cells dialog box and then select the number
    5·1 answer
  • A form of speech that is used to clarify, describe, demonstrate, and/or explain is referred to as _____.
    7·2 answers
  • Symbic Foods, a chain of fast food restaurants, has included a drop-down menu on its main Web site. With this drop-down menu, pe
    13·1 answer
  • Two threads try to acquire the same resource at the same time and both are blocked. Then, they continually change their states i
    14·1 answer
  • I need to reverse a inputted word using for loops with range 0 to the input word and increment 1.
    5·1 answer
  • 1. Select two forms of case designed suitable for ATX power supply and
    13·1 answer
  • When a company sends you recommendations of what to buy you know that :
    12·1 answer
  • To speed up data retrieval, more vehicles will be upgraded to cellular connections and be able to transmit data to the ETL proce
    9·1 answer
  • An IT company has a HealthCare application with data security requirements such that the encryption key must be stored in a cust
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!