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
From the ages of 18 to 24, individuals born from 1980 to 1984 held an average of 6.2 jobs—which is slightly higher than the numb
Romashka [77]

Answer:

The parameters mentioned show how millennials have a much more marked tendency to job instability, that is, to change jobs more frequently than previous generations.

This is explained by two fundamental factors: on the one hand, the millennial generation differs from previous generations, especially because of their constant need for change and their greater emotional instability, which has a decisive influence on their constant and abrupt changes in their daily routines. , including their jobs; on the other, the deregulation of labor markets worldwide, which, on the one hand, have reduced the percentages of the unemployed population on the planet, but on the other hand, have given employers greater facilities to fire their employees, with which they they must change jobs more quickly.

3 0
3 years ago
Which can be used to plan a program?
Marina86 [1]

Answer:

Pseudocode.

Hope this helps you...

Explanation:

8 0
3 years ago
Read 2 more answers
Look at the options below. Which one is a simulation?
Elena-2011 [213]

Im going to guess the 2nd one.

The 1st one just shows how trees can make ____ and then goes to water, the sun, then the rain but it CAN be used as one.

The 2nd one seems to explain the best it can show about weather, water, landforms, the sun, and seems like a better one to choose.

5 0
3 years ago
What does 32mb SVGA do
Nadya [2.5K]

Answer:

hope it helps PLZ MARK ME BRAINLIEST,,!

Explanation:

They stabilize your grpahic image.

5 0
2 years ago
ROM stores data as you search the internet to help increase the speed of your computer.
olasank [31]

Answer:  

The answer to the following question is "false".  

Explanation:  

In computer science, ROM stands for read-only memory. ROM is an electronic device that stores data. It is non-volatile which means that the data is saved even if the part drops power. Once information has been signed into a ROM, it cannot be removed and can only be read.  So the answer to this question is "false".

5 0
3 years ago
Other questions:
  • What are threats to computer system
    5·2 answers
  • The mutt software is an example of what type of mail service software on Linux? a. Mail Delivery Agent b. Mail Transport Agent c
    5·1 answer
  • Juliet is trying to increase her savings account and she decides that she is going save an additional $700 every month. If her m
    9·1 answer
  • What is often called a platform, a collection of computer programs that work together to manage hardware and software to ensure
    12·1 answer
  • 5. Drawing Conclusions If you were a person in
    10·1 answer
  • To a traditional computer, one means
    8·1 answer
  • Although some families have more resources than other families, there is always a limited amount of resources that families have
    15·2 answers
  • Which statement outputs a double value in a field of nine characters with three digits after the decimal point?
    13·1 answer
  • Encryption is an important topic in math and computer science. It keeps your personal information safe online.
    6·1 answer
  • Which of the following is the biggest issue facing wireless communication today?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!