Question: Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Specify the instance variables and

Write an inheritance hierarchy for classes Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Use Quadrilateral as the superclass of the hierarchy. Specify the instance variables and methods for each class. 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). Hint: Create and use a Point class to represent the corners of the shapes.(use java and please it's not allowed to se any math.abs, math.max etc)
Sample output:
Coordinates of Quadrilateral are: (1.1,1.2),(6.6,2.8),(6.2,9.9),(2.2,7.4)
Coordinates of Trapezoid are: (0.0,0.0),(10.0,0.0),(8.0,5.0),(3.3,5.0)
Height is : 5.0
Area is : 36.75
Coordinates of Parallelogram are: (5.0,5.0),(11.0,5.0),(12.0,12.0),(6.0,6.0)
Width is : 6.0
Height is : 15.0
Area is : 90.0
Coordinates of Rectangle are: (17.0,14.0),(30.0,14.0),(30.0,28.0),(17.0,28.0)
Width is : 13.0
Height is : 14.0
Area is 182.0
Coordinates of Square are: (4.0,4.0),(8.0,8.0),(8.0,4.0),(4.0,4.0)
Side is : 4.0
Area is : 16.0

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!