ulvis.paste.net

Paste Search Dynamic
Recent pastes
radius of a sphere is taken an
  1. /* Matt Violet, Java, November 29 2011
  2. radius of a sphere is taken and multiple values are given*/
  3.  
  4.     import TerminalIO.KeyboardReader;
  5.  
  6. public class Radius {
  7.  
  8.     public static void main(string [] args) {
  9.  
  10.         KeyboardReader reader = new KeyboardReader();
  11.  
  12.         double radius;
  13.         double diameter;
  14.         double circumfrence;
  15.         double surfacearea;
  16.         double volume;
  17.         int choice;
  18.  
  19. system.out.print(" Do you want to find out many values of sphere?! if yes, enter 1");
  20. choice = reader.readInt();
  21.  
  22.         while ( choice == 1){
  23.  
  24.         system.out.print(" Enter the radius of the sphere: ");
  25.         radius = reader.readDouble();
  26.  
  27.         diameter = radius * 2;
  28.         system.out.println(" The diameter is:" + diameter );
  29.  
  30.         surfacearea = 4 * 3.14 * (radius * radius);
  31.         system.out.println(" The surface area is:" + surfacearea);
  32.  
  33.         volume = (4 / 3) * 3.14 * (radius * radius * radius);
  34.         system.out.println(" The volume is:" +volume);
  35.  
  36.         circumfrence = radius * 2 * 3.14;
  37.         system.out.println(" The circumfrence is:" + circumfrence );
  38.  
  39.         system.out.print(" Do you want to find out many values about the sphere?! if yes, enter 1");
  40.  
  41.         choice = reader.readInt();
  42.  
  43.  
  44.         }
  45.         }
  46.         }
Parsed in 0.028 seconds