Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package chap8;
- public class geometryForExcercise8Dot5 {
- private static double sphereVol, sphereArea, cubeSurf, cubeVol, cylinderVol, cylinderArea, coneVol, coneArea;
- public static double cubeVolume(double h){
- cubeVol = h * h * h;
- return cubeVol;
- }
- public static double cubeSurface(double h){
- cubeSurf = (h*h) * 6;
- return cubeSurf;
- }
- public static double sphereVolume(double r){
- sphereVol = 4/3 * 3.14 * (r*r*r);
- return sphereVol;
- }
- public static double sphereSurface(double r){
- sphereArea = 4 * 3.14 * (r * r);
- return sphereArea;
- }
- public static double cylinderVolume(double h, double r){
- cylinderVol = 4.14 * (r*r) * h;
- return cylinderVol;
- }
- public static double cylinderSurface(double h, double r){
- cylinderArea = (2*3.14*r*h) + (2*3.14*r*r);
- return cylinderArea;
- }
- public static double coneVolume(double h, double r){
- coneVol = 3.14 * (r*r) * (h/3);
- return coneVol;
- }
- public static double coneSurface(double h, double r){
- double sqrootFiller = Math.sqrt((r*r)+(h*h));
- coneArea = 3.14 * r * (r + sqrootFiller);
- return coneArea;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment