Source of Sphere.java


  1: //Sphere.java
  2: //A concret class that extends the abstract class RoundShape.

  4: public class Sphere
  5: extends RoundShape
  6: {
  7:     //Constructor
  8:     public Sphere(int xCenter, int yCenter, double radius)
  9:     {
 10:         super(xCenter, yCenter, radius);
 11:     }

 13:     //Return surface area of sphere
 14:     public double getArea()
 15:     {
 16:         return 4.0 * Math.PI * Math.pow(radiusOfRoundShape, 2.0);
 17:     }
 18: }