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
Which type of memory helps in reading as well as writing data?
Anuta_ua [19.1K]

The read-write type of memory helps in reading as well as writing data. This computer memory is used by users to continually update the data (to access (read from) or alter (write to) ) that is held on hardware storage devices. Internal or external hard disk drives, rewritable CDs or small flash drives can be all physical setups of read-write memory.

6 0
3 years ago
Given four inputs: a, b, c &amp; d, where (a, b) represents a 2-bit unsigned binary number X; and (c, d) represents a 2-bit unsi
Amiraneli [1.4K]

Answer:

z = a.c' + a.b.d' + b.c'.d'

Explanation:

The truth table for this question is provided in the attachment to this question.

N.B - a' = not a!

The rows with output of 1 come from the following relations: 01 > 00, 10 > 00, 10 > 01, 11 > 00, 11 > 01, 11 > 10

This means that the Boolean expression is a sum of all the rows with output of 1.

z = a'bc'd' + ab'c'd' + ab'c'd + abc'd' + abc'd + abcd'

On simplification,

z = bc'd' + ab'c' + ac'd' + ac'd + abc' + abd'

z = ac' + abd' + bc'd'

Hope this helps!

6 0
3 years ago
Which type of vulnerability scan mimics the work of a threat actor who has already exploited a vulnerability and compromised cre
Vilka [71]

There are different type of vulnerability scan. The type of vulnerability scan mimics the work of a threat actor is called Credential Vulnerability Scan.

Credential Vulnerability Scan is known to be a scan in which there is a valid authentication of credentials Example are usernames and passwords etc. are known to be supplied to the vulnerability scanner to mimic the work of a threat actor that has these credentials.

They are known to be very slow but can give an in-depth insight into the system by accessing a wide range of the installed software  

Learn more from

brainly.com/question/14728460

5 0
2 years ago
A computer game that can be purchased online and played right away has good _____ utility.
ratelena [41]
D. Time

It’s easy to access any time even after it was just purchased.

I hope this helped
6 0
3 years ago
Which of the following roles is responsible for creating cloud components and the testing and validation of services?
DanielleElmas [232]

Answer:

The correct answer to the following question will be Option D (Cloud service developer).

Explanation:

  • Developers are usually individuals who layout and build applications or websites such as web or software systems. They would be known as app or web developers in this regard. In the sense that they still build and maintain things, a software developer is quite similar, however-and here's the deciding factor-this is achieved on virtual clouds.
  • It is the responsibility of the cloud service developer to design and build cloud elements and products, as well as to check and validate services.

Therefore, Option D is the right answer.

7 0
3 years ago
Other questions:
  • Which piece of personal information do websites often require users to enter?
    6·2 answers
  • Which characteristic would be best for a person seeking a career in the Telecommunications pathway?
    15·1 answer
  • Predict how digital video will be viewed in the future. Step into the year 2028. How are people viewing digital video? Or have w
    13·2 answers
  • Over the past few years a very definite need has arisen in the electrical trades for:
    15·1 answer
  • What is the base for a hexadecimal number system?
    11·1 answer
  • @anthonydboss23<br><br> it’s goldielove6 <br><br> .....this is not a question everyone ignore this
    11·2 answers
  • What is computer generation.<br>name that generations ​
    9·2 answers
  • JPG is considered a lossy file format. What does this mean?
    15·2 answers
  • Finish the program by choosing the correct terms.
    7·2 answers
  • Where to store <br> ammunition
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!