Question: Write a class named Hexagon that extends GeometricObject and implements the Comparable interface. Assume all six sides of the hexagon are of equal size. The
Write a class named Hexagon that extends GeometricObject and implements the Comparable interface. Assume all six sides of the hexagon are of equal size. The Hexagon class is defined as follows:
public class Hexagon extends GeometricObject implements Cloneable, Comparable { private double side; /** Construct a Hexagon with the specified side */ public Hexagon(double side) { // Implement it }
@Override public double getArea() { // Implement it () }
@Override public double getPerimeter() { // Implement it }
@Override public int compareTo(Hexagon obj) { // Implement it (compare two Hexagons based on their sides) }
@Override public Object clone() { // Implement it } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
