Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started