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
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