   import java.io.*;
   import java.util.*;

/********************************************************************
* This class calculates the square roots of numbers.
*
* @author: Jonathan Herman
* @version: v2
********************************************************************/
// Elizabeth Adams
// Date: 1/12/07
// Lab: 4
// Section: 2
    public class IO_hermanjl_Rooter
   {
   
   /**
   *This method asks the user for numbers and calculates their sqrt.
   *
   *@param args command line arguments-unused
   */
       public static void main(String[] args)
      {
         double          value, result; // the number taken in, the number output 
         PrintWriter     screen;        
         Scanner         keyboard;    
              
         screen   = new PrintWriter(System.out); // for output     
         keyboard = new Scanner(System.in);                   // for input
       
         
         // asks for a number to work on
         screen.println("Enter a number: ");
         screen.flush();
       
          // asks for and acts upon numbers until the user stops giving input
         while (keyboard.hasNext()) // makes the loop stop when no input is given
         {
            // stores the input into value and stores the sqrt
            value = keyboard.nextDouble();
            result = Math.sqrt(value);
         
            // prints out value and its sqrt stored in result
            screen.printf("The square root of " + value + " is " + result);
            screen.flush();
            // prompts for another number to act upon 
            screen.println("Enter a number: ");       
            screen.flush();
         }
      
         screen.println("Done.\n");       
         screen.flush();
      }
    
   }
