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]
3 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]3 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
after landing, you are tying down the aircraft when a person approaches and asks: "faa. are you the pilot of this aircraft?" wha
Elden [556K]
I wouldn’t say anything because no-one is allowed in the pilot room and also i am landing the aircraft down but the I would talk to them after the flight
3 0
2 years ago
The internet in this Packet Tracer network is overly simplified and does not represent the structure and form of the real intern
Vlad1618 [11]

Incomplete question. However, I answered from a general IT perspective.

<u>Explanation:</u>

It is important to note that the internet |(or real internet) in this case, refers to a global network of interconnected networks (internetworks) linked together for the purpose of communication. In other words, it is a broad global network arranged in a mesh network topography form.

It is also important to <em>remember </em>that nobody owns the internet, in other words, it is open an source network. So some internet service providers (ISPs) have a business model where they make revenue by having users pay in other to have the internet service delivered to them.

6 0
2 years ago
How to do the for loop in python
shusha [124]

Answer:

To loop through a set of code a specified number of times, we can use the range() function, The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and ends at a specified number.

Explanation:

hope this helps

8 0
2 years ago
What are some signs that could help you determine that a date and time was inserted as a special object instead of
Jlenok [28]

Answer:

i) It is difficult to put the mouse pointer's insertion point in the text

ii) A gray border appear around the time and date when you point to it

Explanation:

When the date and time is pointed to or hovered using the mouse pointer, we have, that the background of the text changes to a grey border around the text when the date and time is inserted as a special object using the insert date and time button on the insert menu in the word processing application

The mouse pointer behaves different when working with some applications, and it could be difficult to place the insertion point of the mouse pointer in the  text

Therefore, the correct options are;

<em>It is difficult to put the mouse pointer's insertion point in the text and</em>

<em>A gray border appear around the time and date when you point to it.</em>

3 0
2 years ago
A technician wants to replace a failing power supply on a high-end gaming computer. which form factor should the technician be l
Semmy [17]

A technician need to use the form factor or the  technician be looking for what we call EPS12V.

<h3>What is an EPS power connector?</h3>

The EPS connector is known to be used to supply power to the  motherboard CPU socket and the PCI is known to be one that functions to express connector.

Note that this is said to be a server standard (EPS12V) and it is also known to be one that can be said to be a desktop standard (ATX12V).

Note that the EPS12V is one that is known to always be seen in an 8-pin CPU connector and therefore, A technician need to use the form factor or the  technician be looking for what we call EPS12V.

Learn more about technician from

brainly.com/question/2328085

#SPJ1

5 0
1 year ago
Other questions:
  • Problem 1: Create a list that contains the months of the year. Problem 2: Create a loop to print the month number and name (do n
    7·1 answer
  • If a computer is not working properly,the best thing to do is ________?
    5·2 answers
  • The word Only is absolute or qualified
    8·2 answers
  • Having friends who cause you stress can decrease your happiness, which can in turn
    13·2 answers
  • Why is distance learning better
    12·2 answers
  • Bro i swear whenever i play fortnite duos, they ask you if you don't have a mic, if you don't then they just leave, so annoying
    15·2 answers
  • What legal protection would cover a person invention?
    10·2 answers
  • Please help ASAP!
    7·2 answers
  • Which of the following IS an operating system? *<br> Reddit<br> Ubuntu<br> Office 365<br> Mac Pro
    9·1 answer
  • Topic: Drivers ed 100 points and brainliest!
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!