//Cone.java public class Cone { private double radius; private double height; private String id; public Cone() { radius = 1; height = 1; id = super.toString(); //"class name @ hashcode" } public Cone( double r, double h ) { radius = r; height = h; id = super.toString(); } public Cone(Cone that) { radius = that.radius; height = that.height; id = super.toString(); } public double getArea() { return Math.PI * radius * Math.sqrt(radius * radius + height * height) + Math.PI * radius * radius; } public double getVolume() { return 1.0/3.0 * Math.PI * radius * radius * height; } public String toString() { return id + " r=" + radius + " h=" + height; } public boolean equals(Cone that) { if (this.radius==that.radius && this.height==that.height) return true; else return false; } public int areaCompareTo(Cone that) { double thisArea = this.getArea(); double thatArea = that.getArea(); if (thisArea < thatArea) return -1; else if (thisArea > thatArea) return 1; else return 0; } public int volumeCompareTo(Cone that) { double thisVolume = this.getVolume(); double thatVolume = that.getVolume(); if (thisVolume < thatVolume) return -1; else if (thisVolume > thatVolume) return 1; else return 0; } }