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
Tju [1.3M]
3 years ago
9

Create a base class named rectangle that contains lenght and width data members.

Computers and Technology
1 answer:
kumpel [21]3 years ago
4 0

Answer:

class Rectangle:  

   

   def __init__(self, length, width):

       self.length = length

       self.width = width

       

   

   def area(self):

       area = self.length*self.width

       return area

   

   

class Box (Rectangle):

   

   def __init__(self, length, width, height):

       super().__init__(length, width)

       self.height = height

       

   def volume(self):

       volume = self.length * self.width * self.height

       return volume

   

   def area(self):

       area = 2*(self.length*self.width) + 2*(self.length*self.height) + 2*(self.width*self.height)

       return area

rec_1 = Rectangle(2,4)

box_1 = Box(2,2,6)

print(box_1.length)

print(box_1.area())

   

print(rec_1.length)

print(rec_1.area())

Explanation:

The programming language used is python.

class Rectangle

The class Rectangle is created with attributes length and width.

The class attributes are initialized using the __init__ constructor.

In the rectangle class, a method/function is declared to return the area of the rectangle.

class Box

This class is a child of rectangle and it inherits all its attributes and methods,

It has an additional attribute of depth and its constructor is used to initialize it.

The class contains a volume function, that returns the volume and an override function 'area()' that displaces the area from the parent class.

Finally, some instances of both classes are created.

You might be interested in
In five to ten sentences, explain what netiquette is and how it improves efficiency and productivity in the workplace.
dlinn [17]

Netiquette is a form of communication done correctly online. Good netiquette involves respecting others privacy, using correct grammar, and not doing anything online that will annoy or disrupt others. It is important to have netiquette while online, because communication online is non verbal and you can’t tell how someone is reacting. Having netiquette is important. It implies that you have polite behaviors, and want to build up relationships with people in your work space or at a party you plan on attending. Netiquette is one way to show respect to a person, and to show that you deserve respect. It improves how you organize your writing, and shows how productive you can be. By helping you to become polite online and respectful to other users of the internet, Netiquette is especially important for future letters, emails, or other writing forms.


4 0
3 years ago
Read 2 more answers
Vẽ sơ đồ lắp đặt gồm 2 cầu chì, 1 ổ điện, 2 cực điều khiển 2 đèn mắc song song
Nookie1986 [14]

Answer:

okokikhjhghjjjkkkkkokoloo

7 0
3 years ago
Computers help eliminate the repetitiveness of manual task how can this benefit you in your overall career?
rjkz [21]

Answer:

Explanation:

When I went to high school, our next door neighbor had a pet dinosaur. We used to have to do math problems that were incredibly long and tedious. Things like the gas laws. They involve 5 numbers with 2 decimal places and we were asked to find the 6th number.

Eventually we were taught to use log tables but by then we were too numb to care.

Computers however take repetitiveness in their stride. They don't gag at how many times they have to repeat an operation. They don't mind if they do it a thousand times or a million or 100 million times. Some algorithms like the Monte Carlo method depend on trying an operation a million times. Humans would go crazy if they had to do that. Computers can do simple algorithms a million times while the mouse is on the go command.

If you pick a job like a tax consultant, you will be glad not to do any more than knowing where the numbers that make up your data go.

Same with banks and insurance jobs. I'll bet there are many jobs in medicine that require repetitive calculations.

7 0
2 years ago
A server technician has been tasked with purchasing cables and connectors for a new server room. The server room consists of one
Rama09 [41]

Answer:

The answer is "Option b"

Explanation:

A straightforward cable is a form of twisted pair cable, which is used in the  LAN cable, it provides the connections to RJ-45 cable, that pinout to each end for the same connection. In this cable, that is a sequel, the same kind of computer was interlinked for used by the same routers ports, that's why the technician purchase this cable, and certain options were incorrect that can be described as follows:

  • In option a, It is used in the television, that's why it is wrong.
  • Option c and Option d both were wrong because It is used in telephones, that provides low-speed apps, and it terminates the network.
5 0
3 years ago
Characteristics of a deterministic system<br>​
Fiesta28 [93]

Explanation:

deterministic system is a involved in development of future states of the system is called deterministic determinstic system.

3 0
3 years ago
Other questions:
  • Before using the data type string, the program must include the header file ____.
    6·1 answer
  • 1. Do you consider Facebook, MySpace, and LinkedIn forms of disruptive or sustaining technology? Why?
    15·1 answer
  • In information systems, _____ is information from a system that is used to make changes to input or processing activities.
    6·1 answer
  • George enters the types of gases and the amount of gases emitted in two columns of an Excel sheet. Based on this data he creates
    6·1 answer
  • What correctly describes the features of the service called kickstarter?
    14·2 answers
  • Create a method called letterGrade that will pass the student's average grade as a parameter and return a letter grade (char). O
    12·1 answer
  • It is easier to make an object move across the screen by using the tweening function rather than creating each individual frame
    5·1 answer
  • Describe some things that this person might say that might cause you to NOT hire them. Explain.
    6·1 answer
  • What are the basic data types supported in C programing language?
    10·1 answer
  • On a leading-trailing system technician A says that both shoes do equal work when stopping while going in reverse. Technician B
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!