inJava

Write an inheritance hierarchy for classes Ouadrilateral, 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 (le, 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). OUTPUT: Coordinates of Quadrilateral are: (1.1, 1.2), (6.6, 2.8), (6.2, 9.9), (2.2, 74) Coordinates of Trapezoid are: (0.0, 0.0), (10.0, 0.0), (8.0, 5.0), (3.3, 5.0) Height is: 5 Area is: 36.75 Coordinates of Parallelogram are: (5.0, 5.0), (11.0, 5.0), (12.0, 20.0). (6.0, 20.0) Width is: 6 Height is: 15 Area is: 90 Coordinates of Rectangle are: (17.0, 14.0), (30.0, 14.0), (30.0, 28.0), (17.0, 28.0) Width is: 13 Height is: 14 Area is: 182 Coordinates of Square are: (4.0, 0.0), (8.0, 0.0), (8.0, 4.0), (4.0, 4.0) Side is: 4 Area is: 16 Show transcribed image text Write an inheritance hierarchy for classes Ouadrilateral, 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 (le, 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). OUTPUT: Coordinates of Quadrilateral are: (1.1, 1.2), (6.6, 2.8), (6.2, 9.9), (2.2, 74) Coordinates of Trapezoid are: (0.0, 0.0), (10.0, 0.0), (8.0, 5.0), (3.3, 5.0) Height is: 5 Area is: 36.75 Coordinates of Parallelogram are: (5.0, 5.0), (11.0, 5.0), (12.0, 20.0). (6.0, 20.0) Width is: 6 Height is: 15 Area is: 90 Coordinates of Rectangle are: (17.0, 14.0), (30.0, 14.0), (30.0, 28.0), (17.0, 28.0) Width is: 13 Height is: 14 Area is: 182 Coordinates of Square are: (4.0, 0.0), (8.0, 0.0), (8.0, 4.0), (4.0, 4.0) Side is: 4 Area is: 16

## Expert Answer

Answer to Write an inheritance hierarchy for classes Ouadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilate…