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
What do students buy when they pay tuition?
Marizza181 [45]

Answer:

the right to attend classes at a school

Explanation:

This question seeks to address why we go to school. We go to school to study and get certificates of qualification. To study, we have to pay tuition fees. Tuition fees constituent fifty percent of a school’s income, and without it, you will not be able to get into a classroom in the first place. It covers almost 70% of what the student does in school and this to study in a class. It pays for all academics and research, the library, teaching support, and many more. A place to live at a school and transportation expenses are probably not included in tuition fees. These are other expenses that a student requires to survive.

4 0
3 years ago
Read 2 more answers
The set of rules for how computers talk to one another is called
lianna [129]
Protocol. Like TCP/IP or HTTP etc
6 0
3 years ago
When creating a study schedule, why is it important to be realistic about how much time everything requires?
postnew [5]

Answer:

It makes it easier for you to pass you end goal

6 0
2 years ago
Read 2 more answers
Thsi is for gacha girl5467
djyliett [7]

Answer:

lol

Explanation:

3 0
3 years ago
Read 2 more answers
You need to install a 32-bit application on a 32-bit version of windows 10. In which default directory will the application be i
luda_lava [24]

Answer:

%systemdrive%\Program Files

7 0
2 years ago
Other questions:
  • 4. When you're working with a word processing document and you press the Del key, what happens?
    8·2 answers
  • How might writing an online journal be different than writing in a paper one ​
    15·2 answers
  • I have tried installing "windows media player" on my computer but at a point, something disrupts its instalment or I am asked to
    7·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
  • A presentation has bullet points that move. The presenter wants to use these bullet points in several other places in the presen
    6·1 answer
  • My name Jeff <br><br> what movie is this off of
    6·2 answers
  • The concept of "space" on a computer usually refers to the___.​
    7·1 answer
  • About how long did it take to photograph Daguerre's photograph of the street?
    7·1 answer
  • What science category includes physics and biology?
    14·1 answer
  • How can random numbers in a range be generated in Java?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!