Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Problem_2 {
- /**
- * @param args
- */
- public static void main(String[] args)
- // TODO Auto-generated method stub
- {
- @SuppressWarnings("resource")
- Scanner keyboard = new Scanner(System.in);
- double radius, area_circle, volume_sphere, circumference, surface_sphere;
- System.out.println("Enter desired radius");
- radius = keyboard.nextDouble();
- System.out.println("your radius of "+radius+" inches simulates");
- area_circle = radius * radius *3.14;
- circumference = 2 * 3.14 * radius;
- volume_sphere = (3.14 * 4 * (radius * radius * radius)/3);
- surface_sphere = 4 * 3.14 * (radius * radius);
- System.out.println("A circle with the area of "+area_circle+" ");
- System.out.println("A sphere with the volume of "+volume_sphere+" ");
- System.out.println("A circle with the circumference of "+circumference+" ");
- System.out.println("A sphere with the surface area of "+surface_sphere+" ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement