Solved

Write a Class Named Hexagon That Extends GeometricObject and Implements

Question 14

Essay

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 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 ( 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 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 (   ) } /** 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) } } )
}
/** 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)
}
}

Correct Answer:

verifed

Verified

public class Hexagon extends GeometricOb...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents