Question: JAVA Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy since all other classes

JAVA

Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy since all other classes are derived from Quadrilateral. You are being provided with a Point class, use it to represent the points in each shape. For e.g. the private instance 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 objects area (except Quadrilateral).

Quadrilateral: Data: Point topLeft, topRight, bottomLeft, bottomRight;

Methods: Constructors, getters, setters, toString

All derived classes: Each derived class must have its own instance data like side for Square, length & width for Rectange and so on.

Methods: Constructors, setters, getters, to String, get Area()

JAVA Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!