// Class to represent a circle public class Circle implements Shape { private double radius; public Circle(double radius) { this.radius = radius; } // returns the area of this circle public double area() { return Math.PI * radius * radius; } // compares this circle to other by area // pre: other != null public int compareTo(Shape other) { if (this.area() < other.area()) { return -1; } else if (this.area() > other.area()) { return 1; } else { return 0; } } public String toString() { return "circle of area " + String.format("%.3f", area()); } }