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, 23.06.2019 06:30
To become an audio technician, the most successful tactics might include the following. (select all that apply). learning how to persuade other people gaining different types of experience in audio technology learning as much as possible about art history establishing a reputation as a reliable professional
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Choose the answers that best complete each sentence. on average,are more expensive than other kinds of postsecondary schools. the cost of room and board includes. to save money, some students attend auniversity in their home state.
Answers: 2
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
question
Computers and Technology, 24.06.2019 12:50
Write a new lc-3 trap subroutine (i.e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i.e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e.g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e.g. b0000 0000 0000 0111 =
Answers: 3
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
Mathematics, 18.03.2021 03:30
question
Mathematics, 18.03.2021 03:30
question
Mathematics, 18.03.2021 03:30
question
Mathematics, 18.03.2021 03:30
question
History, 18.03.2021 03:30
Questions on the website: 13722362