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]
3 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]3 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
If You're is in credit card debt, why can't you just say your card was stolen so you can avoid the debt.
liubo4ka [24]
You can not claim this because most times credit card issuers will be able to match purchases and charges to your location, ex stores around you, online purchases sent to your location.
8 0
3 years ago
Read 2 more answers
The clock interrupt handler on a certain computer requires 2ms (including process switching overhead) per clock tick. The clock
salantis [7]

Considering the situation described above, the fraction of the CPU execution that is devoted to handling clock interrupts "<u>12 percent</u>."

<h3>CPU Execution process.</h3>

The process of CPU Execution involves the execution of an instruction which in life fetches an instruction from memory through its ALU to carry out an operation and then saves the result to memory.

To illustrate the fraction of the CPU execution that is devoted to handling clock interrupts, we have:

60 × 2 msec = 120 msec ÷ 1 sec = 12 percent.

Hence, in this case, it is concluded that the correct answer is <u>12 percent CPU</u> devoted to the clock.

Learn more about the CPU execution here: brainly.com/question/14400616

4 0
3 years ago
___ CRM systems use social media technology and services to enable organizations to engage their customers in a collaborative co
seraphim [82]

Answer:

The correct answer for the given question is social.

Explanation:

Social CRM is used the social media services  technique to busy her client for the organization.

Social CRM is an "customer relationship management " CRM.

Social CRM managing the information of customer data.

Social CRM increases the sales in the organization.

8 0
3 years ago
Uppose a computer processor can perform about 3.8 billion operations per second. how many operations can it perform in 0.6 ​seco
Ratling [72]
We have information:
3.8 billion         1 second
x billion            0.6 second

To find out the number of operations we need to cross multiply these equations and solve for x.
3.8 * 0.6 = 1*x
x = 2.28 billion

In 0.6s computer can do 2.28 billion operations.
4 0
3 years ago
Read 2 more answers
8. What is output by the code segment below?
vova2212 [387]

Answer:

b. 1 2 3 4 5

Explanation:

Let us analyze the given code one statement at a time.

int [] x = {1,2,3,4,5};  // Initializes an integer array x

int [] y = new int [5] ; // Allocates a new integer array y

for (int i : x)

y = x;

This assign the variable y with the array x

for (int i : y)

System.out.print (i + " ");

The content of the attay y is printed one element at a time.

The final output will be as follows:

1 2 3 4 5

4 0
3 years ago
Other questions:
  • Jackson is teaching the decimal number system. He wants his students to know how to expand numbers by powers of 10. Which is the
    13·2 answers
  • 20. A new technology that will change the role of the transcriptionist is
    6·1 answer
  • Add a function named circle to the polygons module. This function expects the same arguments as the square and hexagon functions
    9·1 answer
  • An example of human API would be when:
    5·2 answers
  • PLEASE HELP ME ASAP ;(
    15·1 answer
  • If a small monster collector:- Has 16 small monster containment devices and intends to use all of them.
    10·1 answer
  • You can change the size of text using which block of code?
    11·1 answer
  • What does a codec do? Choose all that apply.
    5·2 answers
  • True/False? In association rule learning, the following two rules will always have the same support value.
    9·1 answer
  • A computer hardware feature that is vital to the effective operation of a multiprogramming operating system is:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!