Question: Write a class named Hexagon that extends Geometric Object and implements the Comparable interface. Assume all six sides of the hexagon are of equal size.
Write a class named Hexagon that extends Geometric Object 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 Geometric Object implements Comparable {private double side;/** Construct a Hexagon with the specified side */public Hexagon(double side) {//Implement it}/** Implement the abstract method getArea in GeometricObject */public double getArea() {//Implement it (area = 3 * Squareroot 3 * side * side))/** Implement the abstract method getPerimeter in GeometricObject */public double getPerimeter() {//Implement it}/** Implement the compareTo method in the Comparable interface to */public int compareTo(Object obj) {//Implement it (compare two Hexagons based on their areas)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
