Advertisement
jbozhich

Problem_2

Sep 25th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class Problem_2 {
  5.  
  6.     /**
  7.      * @param args
  8.      */
  9.     public static void main(String[] args)
  10.         // TODO Auto-generated method stub
  11.     {
  12.     @SuppressWarnings("resource")
  13.     Scanner keyboard = new Scanner(System.in);
  14.     double radius, area_circle, volume_sphere, circumference, surface_sphere;
  15.     System.out.println("Enter desired radius");
  16.     radius = keyboard.nextDouble();
  17.     System.out.println("your radius of "+radius+" inches simulates");
  18.     area_circle = radius * radius *3.14;
  19.     circumference = 2 * 3.14 * radius;
  20.     volume_sphere = (3.14 * 4 * (radius * radius * radius)/3);
  21.     surface_sphere = 4 * 3.14 * (radius * radius);
  22.     System.out.println("A circle with the area of "+area_circle+" ");
  23.     System.out.println("A sphere with the volume of "+volume_sphere+" ");
  24.     System.out.println("A circle with the circumference of "+circumference+" ");
  25.     System.out.println("A sphere with the surface area of "+surface_sphere+" ");
  26.            
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement