Question: Consider the following abstract class Shape, which represent all kinds of shapes. A shape object has a center and a method to compute the area

 Consider the following abstract class Shape, which represent all kinds of

Consider the following abstract class Shape, which represent all kinds of shapes. A shape object has a center and a method to compute the area of the shape. Of course, you cannot instantiate the shape class. There is no concrete implementation of the area method either For this quiz, you will write a concrete subclass of Shape called Hexagon, which represents a regular hexagon - a polygon with 6 sides of equal length. A regular hexagon needs a variable for its side length. You need to add a two-argument constructor accepting a center and the side length, an accessor method for the side length, and an implementation of the area method. The area of a regular hexagon is 2 You may use the approximation V3-1.73 in your implementation. abstract public class Shape [ private Point center; public Shape (Point center) [ this.center - center; public Point getCenter) I return center; abstract public double area()

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!