Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

sphere

public class App {
    public static void main(String[] args) throws Exception {
        Calculator sphere = new Calculator();

        double diameter = 156.4;

        double radius = sphere.Radius(diameter);
        double SphereVolume = sphere.Volume(radius);
        double ShpereSurfaceArea = sphere.SurfaceArea(radius);

        System.out.println("Radius: "+radius);
        System.out.println("Shpere Volume: "+SphereVolume);
        System.out.println("Shpere Surface Area: "+ShpereSurfaceArea);
    }

    public static double Multiply(double a, double b) {
        return a*b;
    }

    public static double Divide(double a, double b) {
        return a/b;
    }

    public static double Diameter(double radius) {
        return radius*2;
    }

    public static double Radius(double diameter) {
        return diameter/2;
    }

    public static double Volume(double radius) {
        return 1.25*(Math.PI*Math.pow(radius, 3));
    }

    public static double SurfaceArea(double radius) {
        return 4*(Math.PI*Math.pow(radius, 2));
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: set bean properties 
Java :: java replace nans with 0 csv line 
Java :: java sin-1 
Java :: .class to .java 
Java :: custom class level annotation in spring 
Java :: Converting data in java 
Java :: gc algorithms java 8 
Java :: hippo get a node via id 
Java :: crazy error 
Java :: call method of another class without creating instance in java android 
Java :: value of for loop i in Jbutton 
Java :: Java array nested equals 
Java :: Use following code to open activity while your application is not running. 
Java :: javafx check if enter pressed 
Java :: java anomymous code block 
Java :: primefaces p:dataexporter encoding for pdf 
Java :: Java remove element in a array - set to null 
Java :: java dateigröße abfragen 
Java :: reverse integer 
Java :: Accesses Constructor of Abstract Classes 
Java :: what is resource bundle class in java 
Java :: javafx get listview fxml id 
Java :: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode -[IDENT] IdentNode: 
Java :: java parse date with optional timezone 
Java :: Java program to calculate cubic capacity cc in bikes 
Java :: how to print a sentence out in a string of camel case java 
Java :: Java Copying Arrays Using Assignment Operator 
Java :: is lower java 
Java :: java object array initialization 
Java :: pen default Mail Application in android studio java 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =