/** Sphere.java -- an example of a class implementing ThreeD. This means * we must specify both area and volume. */ public class Sphere extends Shape implements ThreeD { private double radius; public Sphere(String n, double r) { super(n); radius = r; } // It might be faster to just use radius*radius, rather than // calling the pow() function. public double findArea() { return 4.0 * Math.PI * Math.pow(radius, 2.0); } public double findVolume() { return 4.0/3.0 * Math.PI * Math.pow(radius, 3.0); } }