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
Consider the practice of outsourcing programmers, a common practice in many U.S. businesses. Think about how this practice is us
GuDViN [60]

The practice of outsourcing programmers is known to be the act of  sharing or delegating as well as handing over control of programming and its associated tasks to any form of  external service provider that is said to be very good in that field and has the power and capabilities to handle the technical and operational areas of a programming project.

<h3>What is outsourcing and why is it always practiced?</h3>

Outsourcing is known to  be a kind of a business practice that entails the act of hiring a party that is known to be outside a company to carry out services or make goods that are said to be traditionally carried out in-house.

Note that The practice of outsourcing programmers is known to be the act of  sharing or delegating as well as handing over control of programming and its associated tasks to any form of  external service provider that is said to be very good in that field and has the power and capabilities to handle the technical and operational areas of a programming project.

Learn more about outsourcing  from

brainly.com/question/12101789

#SPJ1

5 0
2 years ago
What type of element addresses the recovery of critical information technology (it) assets, including systems, applications, dat
TiliK225 [7]

Disaster recovery type of element addresses the recovery of critical information technology (it) assets, including systems, applications, databases, storage and network assets.

<h3>What is disaster recovery plan in information technology?</h3>

A disaster recovery plan (DRP) is a formal document produced by an organization that contains explicit instructions on how to respond to unplanned happenings such as natural disasters, power outages, cyber-attacks and any other disruptive events.

<h3>What is a disaster recovery plan and why is it important to the organization?</h3>

A disaster recovery plan describes procedures for resuming work quickly and reducing interruptions in the aftermath of a disaster. It is an important part of the business continuity plan and it allows for sufficient IT recovery and the precluding of data loss.

To learn more about Disaster recovery, refer

brainly.com/question/24131287

#SPJ4

8 0
2 years ago
Is this code object-oriented, or is it procedural? what clues in the code itself did you use to determine what kind of code it i
Katen [24]

An Object-Oriented code or coding refers to a technique of programming that utilizes the identification of classes of objects that are closely tied to the functions with which they are related.

<h3>What is a Procedural Oriented Code?</h3>

This refers to a kind of programming language that utilizes a step-by-step method so as to break down a task into a set or a collection of factors or variables and routines or sub-routines using a set of instructions that are sequential.

Objects in programming refer to a type of abstract data that has a state and behavior. It is a specific instance of a class.

A class in programming is a templated definition of the techniques and variables of a certain type of object.

<h3>What are some of the principles and structures of coding?</h3>

There are 10 principles of coding. Some of them are:

  1. Keep it simple
  2. Separate concerns
  3. Document your Code etc.

Some of these principles can be used in normal day-to-day activity and even in business. item 1 for instance can be used during communication.  Effective communication is more effective when it is kept very simple.

It is to be noted that the code referenced in the question is unavailable hence the general answer.

Learn more about Object-Oriented Code at:
brainly.com/question/4560494

3 0
2 years ago
Lisa and her husband would like to buy a house soon. She continuously pays bills late. How do her actions affect her and others?
stiks02 [169]
Well actually it affects her credit. Home owners would not want to sell a house to someone who doesn't pay bills on time. It shows he/she is unreliable

3 0
3 years ago
Read 2 more answers
Edhesive 4.2 question 2 answers
Citrus2011 [14]

Answer:

total=0

pet=input("what pet do you have? ")

while pet!= "rock":

   total=total+1

   print("you have a "+pet+" with a total of "+ str(total)+ " pet(s)")

   pet=input("What pet do you have? ")

Explanation: Just copy and paste above again just copy and paste this will get you a 100 percent i made another account just to give yall edhesive answers if yall need help with any edhesive just comment below

7 0
3 years ago
Other questions:
  • In two or more complete sentences, summarize the difference between renewable and nonrenewable resources? Justify your responses
    13·2 answers
  • Draw the flowchart to calculate the area of the rectangle 50m length and width 30m.​
    10·1 answer
  • How can the storage model assist in the design of storage networks?
    12·1 answer
  • You can sort a large array of integers that are in the range 1 to 100 by using an array count of 100 items to count the number o
    9·1 answer
  • The ____ operator executes one of two expressions based on the results of a conditional expression. Group of answer choices
    15·2 answers
  • Destinguish between qualitative data and quantitave
    12·1 answer
  • Which of the following is the most important system if a company wants to consolidate fan data from multiple sources, i.e., exte
    11·2 answers
  • Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can
    9·1 answer
  • What is a network computer that processes requests from a client server​
    11·1 answer
  • The ability to present an effective message with useful content is obviously important to a good _____ presentation.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!