Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.lang.Math;
- public class Geometry {
- public static double sphereVolume(double r){
- double sphereVolume = (4/3) * Math.PI * r * r;
- return sphereVolume;
- }
- public static double sphereSurface(double r){
- double sphereSurface = 4 * Math.PI * r * r;
- return sphereSurface;
- }
- public static double cylinderVolume(double r, double h){
- double cylinderVolume = Math.PI * r * r * h;
- return cylinderVolume;
- }
- public static double cylinderSurface(double r, double h){
- double cylinderSurface = (2 * Math.PI * r * h) + (2 * Math.PI * r * r);
- return cylinderSurface;
- }
- public static double coneVolume(double r, double h){
- double coneVolume = 1/3 * Math.PI * r * r * h;
- return coneVolume;
- }
- public static double coneSurface(double r, double h){
- double coneSurface = (Math.PI * r) * ( r + Math.sqrt((h* h) + (r * r)));
- return coneSurface;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement