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
Input two numbers and print their sum products difference division and remainder​
likoan [24]

\tt n1=int(input("Enter\: first\:no:"))

\tt n2=int(input("Enter\: second\:no:"))

\tt sum=n1+n2

\tt diff=n1-n2

\tt pdt=n1*n2

\tt div=n1//n2

\tt rem=n1\%n2

\tt print("Sum=",sum)

\tt print("Difference=",diff)

\tt print("Product=",pdt)

\tt print ("Division=",div)

\tt print("Remainder=",rem)

Output:-

Enter first no:4

Enter second no:3

Sum=7

Difference=1

Product=12

Division=1

Remainder=1

7 0
2 years ago
Before you can use the Management Studio to work with the objects in a database, you must ___________ the database files (i.e.,
Lelu [443]

Answer:

You must attach the database files

Explanation:

4 0
3 years ago
Explain where the “heart” of the station is and what can be found there? I will mark brainlyest! This is for the ISS (Internatio
Annette [7]

Answer:

Zevzda

Explanation:

Check for yourself if you think i'm wrong

7 0
2 years ago
Read 2 more answers
What is the definition of overflow in binary?
asambeis [7]
Overflow occurs when the magnitude of a number exceeds the range allowed by the size of the bit field. The sum of two identically-signed numbers may very well exceed the range of the bit field of those two numbers, and so in this case overflow is a possibility.
4 0
3 years ago
What is the difference between a Network Diagram and a Wiring Semantic?
stiks02 [169]

Answer:

Network diagram is the type of graphical networking chart that is basically used in the various type of computer telecommunication. The network diagram is useful for the networking designer and also for the network engineer for compiling the network documentation in detail.

Wiring semantic is the type of open source prototype platform which basically composed of the programming language and the IDE ( Integrated development environment). The wiring semantic consumer can affect the triggering the new data or information from the existing concepts.

7 0
3 years ago
Other questions:
  • Human centered technology often recommends a0 to computer designers and manufacturers, telling them how to make systems and the
    12·2 answers
  • 1. _______ is when two things happen at one time when using the Scratch program.
    6·1 answer
  • Engineers involved in product design and manufacturing use computer-aided design/computer-aided manufacturing (CAD/CAM) systems,
    13·1 answer
  • The ____ is the point in the past to which the recovered applications and data at the alternate infrastructure will be restored.
    15·1 answer
  • Letter Frequency Write a function that will take a string and return a count of each letter in the string. For example, "my dog
    5·1 answer
  • When disabling inherited permissions on an object, what happens if you select Remove all inherited permissions from this object?
    11·1 answer
  • In Google search results, how are organic links different from sponsored links?
    5·2 answers
  • After conducting interviews with several bad candidates, Althea, a manager at Langrover Inc. interviewed a candidate who was bet
    15·1 answer
  • Importance of computer​
    15·1 answer
  • a farmer cultivates 1/4 of his farm with ground nuts and 2/5 of it with maize what is the total landnarea that is cultivated​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!