Advertisement
calcpage

APCS2012_C4X3_IceCreamCone.java

Oct 15th, 2012
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.38 KB | None | 0 0
  1. //IceCreamCone.java MrG 2012.1012
  2. public class IceCreamCone
  3. {
  4.     private double r;
  5.     private double h;
  6.     private final double PI = 3.14159;
  7.  
  8.     public IceCreamCone(double r, double h)
  9.     {
  10.         this.r=r;
  11.         this.h=h;
  12.     }
  13.        
  14.     public double getVol()
  15.     {
  16.         return 1.0/3*PI*Math.pow(r,2)*h;
  17.     }
  18.  
  19.     public double getSurfaceArea()
  20.     {
  21.         return PI*r*Math.sqrt(Math.pow(h,2)+Math.pow(r,2));
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement