daily pastebin goal
10%
SHARE
TWEET

APCS2012_C4X3_IceCreamCone.java

calcpage Oct 15th, 2012 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
Top