In: Computer Science
Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Create and use a Point class to represent the points in each shape. Make the hierarchy as deep ( i.e., as many levels ) as possible. Specify the instance variables and methods for each class. The private instances variables of Quadrilateral should be the x-y coordinate pairs for the four endpoints of the Quadrilateral. Write a program that instantiates objects of your classes and outputs each object’s area (except Quadrilateral).
The answer to this question is first we need to create abstract class Quadrilateral with the points as the top left, top right, bottom left and bottom right and we use these to find the area of the rectangle, square and the remaining
1.Quadrilateral class
2.Parallelogram class
3.Rectangle class
4.Square class