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
alex41 [277]
3 years ago
12

For this exercise, you'll use the Rectangle class below (you can assume that the length and width are measured in feet).

Computers and Technology
1 answer:
dusya [7]3 years ago
8 0

Answer:

The solution code is written in Python:

  1. class Carpet:
  2.    def __init__(self, rect, cost):
  3.        self.size = rect  
  4.        self.costPerSqFoot = cost  
  5.    
  6.    def cost(self):
  7.        carpetCost = self.size.area() * self.costPerSqFoot  
  8.        return carpetCost

Explanation:

Presume that there is existence of Rectangle class as given in the question, Carpet class is written. The Carpet constructor is defined that take Rectangle object,<em> rect</em>, and <em>cost</em> as parameter (Line 2). To create data member of Carpet class, keyword "self" is used to precede with the name of the data members, <em>size </em>and <em>costPerSqFoot </em>(Line 3-4).<em> </em>The data members are initialized with the parameter <em>rect </em>and <em>cost</em>, respectively.

Next, cost method is defined (Line6 - 8). Within the <em>cost </em>method, the area method of Rectangle object is invoked by expression, <em>self.size.area() </em>and<em> </em>this will return the area value and multiplied with the costPerSqFoot to get the carpet cost and return it as output (Line 8).

You might be interested in
A set of communication rules for the computer to follow is called, what?
Irina-Kira [14]

The answer to this question is protocol

5 0
3 years ago
Read 2 more answers
Which type of chart is used to chart progress over time?
Morgarella [4.7K]

Answer: Timeline

Explanation:

6 0
3 years ago
Given the following MIPS Code Fragment:
galben [10]

Answer:

There are 3 Data Hazard

Explanation:

Find attached the solution

6 0
3 years ago
David bought 5.2 pounds of oranges for $1.20 per pound . how much did david spend ..............................................
Tcecarenko [31]

Answer:

David spent $6.24.

Explanation:

5.2 times 1.2

3 0
2 years ago
(a) If host 192.168.0.1 sends out a packet with source IP address 192.168.0.1 and source port number 3345, after the packets lea
Evgen [1.6K]

Question: The question is incomplete. See the complete question below;

Consider the following situation using NAT (Network Address Translation), where the router uses one public IP address, 138.76.29.7, for several hosts with private IP addresses. The NAT table already has the information as shown due to previous communications.

Answer:

Source IP = 208.38.69.1

Source port = 3006

Explanation:

Network Address Translation (NAT) simply means  the translation of one or more local IP address so as to provide internet access to local hosts. In this case, the router uses one public IP address and with private IP address.

8 0
3 years ago
Other questions:
  • What is the accounting equation?
    12·1 answer
  • Using the __________ option, you can change the state of a model back to where a particular feature or features weren`t yet crea
    7·1 answer
  • (Please answer! Correct answer gets brainliest!)
    5·2 answers
  • Give a real life of an if statement
    13·1 answer
  • Which of the following statements is correct?
    11·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    12·2 answers
  • An invisible path determining the way of travel from one place to another.
    10·1 answer
  • How do I make someone "Brainiest". <br> First person to reply will get "Brainiest"
    8·2 answers
  • What are the top 10 most dangerous computer viruses ?
    13·1 answer
  • What is the digital revolution and how did it change society?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!