   import java.io.*;
   import java.util.*;
/*******************************************************************
 * An excersise in managing scanners and user input
 *
 * Lab 5
 * Lab time: 09/08/08 12:20pm 
 * @version 1.0
 * @author Greg Tamargo (tamarggj@jmu.edu)
 *
 *This work complies with the JMU honor code.
 *
 */
    public class Rooter
   {
       public static void main(String[] args)
      {
         double          value, result;       
         PrintWriter     screen;
         Scanner         keyboard;
       
         screen   = new PrintWriter(System.out);//this will be used to gather and store things to output    
         keyboard = new Scanner(System.in);
      
         
         screen.println("Enter a number: ");    
         screen.flush();//this was added to output the text.
       
         while (keyboard.hasNext())//this makes it so that the loop will never end,
                                  //unless the user causes and error or forcively ends the program
         {
            value = keyboard.nextDouble();
            result = Math.sqrt(value);//finds the square root of the inputted value
         
            screen.printf("The square root of \n" + value + " is " + result);//this gets the output ready
            screen.flush();//this gets the output to the user
          
            screen.println("Enter a number: ");//this repeats the process
            screen.flush();
         }
      
         screen.println("Done.\n");//this will only show up if the user hits ctrl+c in cmd.exe
         screen.flush();
      }
    
   }
