subject

For this exercise, you'll use the rectangle class below (you can assume that the length and width are measured in feet).
write a class named carpet that has two data members: size and costpersqfoot. it should have a constructor that takes a rectangle object and a float as parameters and uses them to initialize its data members. it should also have a method named cost that asks the size data member for its area and uses that to calculate and return the cost of the carpet. this is an example of class composition because the carpet class contains a rectangle object as one of its data members.

class rectangle:
"""
represents a geometric rectangle
"""
def , length, width):
self. length = length
self. width = width
def area(self):
return self. length * self. width
def perimeter(self):
return 2 * self. length + 2 * self. width

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
Atool that matches persoal skills qualities interests and talets to a career is called a
Answers: 1
question
Computers and Technology, 22.06.2019 23:00
Which type of tab stop is most for weights and measurements?
Answers: 1
question
Computers and Technology, 23.06.2019 04:20
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy.a. a fire occurs on the premises, and the building isbadly damaged.b. a burglar steals some money and securities from anunlocked safe.c. a business computer is damaged by vandals whobreak into the shop after business hours.d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm.til
Answers: 2
question
Computers and Technology, 23.06.2019 10:00
Install and use wireshark program ( send back screen shots and other vital information) case project 3-2: decode a tcp segment in a wireshark capture in this chapter, you walked through tcp segment to interpret the data included in its header. in this project, you use wireshark to capture your own http messafes, examine the tcp headers, and practice interpreting the data you'll find there. 1. open wireshark and snap the window to one side of your screen. open a browser and snap that window to the other side of your screen so you can see both windows.
Answers: 2
You know the right answer?
For this exercise, you'll use the rectangle class below (you can assume that the length and width ar...
Questions
question
Arts, 08.01.2021 01:50
question
Mathematics, 08.01.2021 01:50
question
History, 08.01.2021 01:50
Questions on the website: 13722363