Richard_Sekol

8.5

Nov 22nd, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. package chap8;
  2.  
  3. public class geometryForExcercise8Dot5 {
  4. private static double sphereVol, sphereArea, cubeSurf, cubeVol, cylinderVol, cylinderArea, coneVol, coneArea;
  5. public static double cubeVolume(double h){
  6. cubeVol = h * h * h;
  7. return cubeVol;
  8. }
  9. public static double cubeSurface(double h){
  10. cubeSurf = (h*h) * 6;
  11. return cubeSurf;
  12. }
  13. public static double sphereVolume(double r){
  14. sphereVol = 4/3 * 3.14 * (r*r*r);
  15. return sphereVol;
  16. }
  17. public static double sphereSurface(double r){
  18. sphereArea = 4 * 3.14 * (r * r);
  19. return sphereArea;
  20. }
  21. public static double cylinderVolume(double h, double r){
  22. cylinderVol = 4.14 * (r*r) * h;
  23. return cylinderVol;
  24. }
  25. public static double cylinderSurface(double h, double r){
  26. cylinderArea = (2*3.14*r*h) + (2*3.14*r*r);
  27. return cylinderArea;
  28. }
  29. public static double coneVolume(double h, double r){
  30. coneVol = 3.14 * (r*r) * (h/3);
  31. return coneVol;
  32. }
  33. public static double coneSurface(double h, double r){
  34. double sqrootFiller = Math.sqrt((r*r)+(h*h));
  35. coneArea = 3.14 * r * (r + sqrootFiller);
  36. return coneArea;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment