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
anastassius [24]
4 years ago
15

Implement a program that manages shapes. Implement a class named Shape with a method area() which returns the double value 0.0.

Implement three derived classes named Rectangle, Square, and Circle. Declare necessary properties in each including getter and setter function and a constructor that sets the values of these properties. Override the area() function in each by calculating the area using the defined properties in that class.
Computers and Technology
1 answer:
Tamiku [17]4 years ago
8 0

Answer:

Explanation:

The following code is written in Python. It creates the parent class Shape and the three subclasses Rectangle, Square, and Circle that extend Shape. Shape has the constructor which is empty and the area method which returns 0.0, while the three subclasses take in the necessary measurements for its constructor. Each subclass also has getter and setter methods for each variable and an overriden area() method which returns the shapes area.

class Shape:

   def __init__(self):

       pass

   def area(self):

       return 0.0

class Square(Shape):

   _length = 0

   _width = 0

   def __init__(self, length, width):

       self._width = width

       self._length = length

   def area(self):

       area = self._length * self._width

       return area

   def get_length(self):

       return self._length

   def get_width(self):

       return self._width

   def set_length(self, length):

       self._length = length

   def set_width(self, width):

       self._width = width

class Rectangle(Shape):

   _length = 0

   _width = 0

   def __init__(self, length, width):

       self._width = width

       self._length = length

   def area(self):

       area = self._length * self._width

       return area

   def get_length(self):

       return self._length

   def get_width(self):

       return self._width

   def set_length(self, length):

       self._length = length

   def set_width(self, width):

       self._width = width

class Circle(Shape):

   _radius = 0

   def __init__(self, radius):

       self._radius = radius

   def area(self):

       area = 2 * 3.14 * self._radius

       return area

   def get_radius(self):

       return self._radius

   def set_radius(self, radius):

       self._radius = radius

You might be interested in
Organizations and individuals use social media marketing in various ways. Which of the following is NOT an application of social
Brilliant_brown [7]

Answer:

D. using social media marketing websites to generate additional revenue by offering paid memberships

4 0
3 years ago
Nick’s computer has been restarting on its own. what action should he take to solve this issue?
serg [7]
Check for possible software updates, my reasoning for that is the computer could be trying to initiate an update but is stopped by the user if you don't want it to update go to settings and turn off auto update
5 0
3 years ago
Which example best describes a school consequence for committing plagiarism?
sergij07 [2.7K]

Answer:

1

Explanation:

6 0
4 years ago
You are a networking specialist supporting a client’s IPv4 network. You want to protect the client’s servers that host sensitive
kaheart [24]

Answer:

Network Segmentation / Segment the network using subsets

Explanation:

You have to do network segmentation. It is a process that dividing computer network into small networks. It increase security and decrease network congestion as well.Network segment protect the clients server host sensitive information such as HR and Finance servers from network.

For example 225.225.255.0 is subnet of 198.51.100.0/24.

traffic exchange between source address and destination address through routers. A routers serves as boundary between subnet.

5 0
4 years ago
Some misconceptionsabout communication are:
IgorLugansk [536]

Answer:

<u>All of the given options</u>

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

Communication is an insanely important and useful, but there are a lot of misconceptions about communication. Based on the answers given in the question, the correct answer would be <u>"All of the Given Options"</u>

Communication can solve many problems but the statement that it can solve all problems is not completely accurate. Whether communication can solve a specific problem depends varies from person to person.

Communication can physically break down since not everyone speaks the same language not everyone can understand each other. Also another physical way is that certain dialogue choices can lead to physical confrontation.

Lastly, the meaning of a word can mean different things to different people. For example, "Happiness" every single person has a unique definition of happiness while others simply say it doesn't exist.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

6 0
4 years ago
Other questions:
  • If I wanted to add code so that the costume of my sprite would change, what menu would I look under to find the "change costume"
    11·1 answer
  • Can my cell phone provider keep track of my internet history?
    10·1 answer
  • In the context of information systems, which of the following is a disadvantage of prototyping? a. A prototype is more difficult
    8·1 answer
  • Tricia needs to tell her browser how to display a web page. What will she need to use? Compiler
    8·1 answer
  • g Define several forms of metadata that can be useful to an investigation. How are valuable to an investigator
    10·1 answer
  • Uhm.....why do we nessairly have to take computer classses
    11·2 answers
  • True or false for a given set of input values, a nand
    7·1 answer
  • What are real online jobs any one of any age can get pays weekly by Pay<br> Pal
    8·1 answer
  • What does it mean that the right mouse button is context-sensitive?
    15·1 answer
  • In disc brakes, pads are forced against the of a brake disc​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!