Question: Java Lab In this lab, you will be implementing the following class hierarchy. Your concrete classes must call the superclass constructor with the proper number

Java Lab

Java Lab In this lab, you will be implementing the following class

In this lab, you will be implementing the following class hierarchy. Your concrete classes must call the superclass constructor with the proper number of sides (which is constant for each concrete shape). The perimeter method is implemented in the superclass as it does not change based on the number of sides. The area method must be overridden in each subclass as the area is dependent on the type of polygon. The areas of an equilateral triangle, square, and a regular hexagon given side length a Squareroot 3/4 a^2, a^2, and 3 Squareroot 3/2 a^2, respectively. The superclass area method should just return 0 as a default, value. You are also responsible for writing a small test driver that instantiates each of the concrete subclasses with test values (not necessarily user input), and prints the perimeter and area of each object to the console

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!