micher43

E8.5

Nov 20th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1.  
  2. public class StaticFunctions {
  3.        
  4.         public static double cubeVolume(double h){
  5.             double cubeVolume;
  6.             cubeVolume = Math.pow(h, 3);
  7.             return cubeVolume;
  8.         }
  9.        
  10.         public static double cubeSurface(double h){
  11.             double cubeSurface;
  12.             cubeSurface = 6 * (Math.pow(h, 2));
  13.             return cubeSurface;
  14.         }
  15.        
  16.         public static double sphereVolume(double r){
  17.             double sphereVolume;
  18.             sphereVolume = (4/3) * Math.PI * Math.pow(r, 3);
  19.             return sphereVolume;
  20.         }
  21.        
  22.         public static double sphereSurface(double r){
  23.             double sphereSurface;
  24.             sphereSurface = 4 * Math.PI * Math.pow(r, 2);
  25.             return sphereSurface;
  26.         }
  27.        
  28.         public static double cylinderVolume(double r, double h){
  29.             double cylinderVolume;
  30.             double circleArea;
  31.             circleArea = Math.PI * Math.pow(r, 2);
  32.             cylinderVolume = circleArea * h;
  33.             return cylinderVolume;
  34.            
  35.         }
  36.         public static double cylinderSurface(double r, double h){
  37.             double cylinderSurface;
  38.             cylinderSurface = (2 * Math.PI * r * h) + (2 * Math.PI * Math.pow(r, 2));      
  39.             return cylinderSurface;
  40.         }
  41.         public static double coneVolume(double r, double h){
  42.             double coneVolume;
  43.             coneVolume = (1/3) * Math.PI * Math.pow(r,2) * h;
  44.             return coneVolume;
  45.         }
  46.         public static double coneSurface(double r, double h){
  47.             double coneSurface;
  48.             double pyThag;
  49.             pyThag = Math.pow(r, 2) + Math.pow(h, 2);
  50.             coneSurface = (Math.PI * r) * (r + Math.pow(pyThag, .5));
  51.             return coneSurface;
  52.         }
  53.        
  54.        
  55.        
  56.     }
Advertisement
Add Comment
Please, Sign In to add comment