Admin
Investor Persona
File name: sphere.java
Display Results:
Enter Radius:
Sphere: xx.xx
- Code:
public class sphere{
public static void main(String[] args)throws IOException{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
double a, pi, sphere, rad;
pi = 3.1416;
System.out.println("Enter Radius:");
System.out.println("");
a = Double.parseDouble(input.readLine());
rad = a*a*a;
sphere = (4.0/3.0)*pi*rad;
System.out.println(" ");
System.out.println("Sphere:"+sphere);
}
}
Display Results:
Enter Radius:
Sphere: xx.xx
No Comment.