import java.io.*;
import java.util.Scanner;
/***********************************************
 * finds the square root of an inputed number
 *
 * @author - Eric Hartway
 * @version - V2 - 1/22/07
 ************************************************/
public class IO_hartwaer_Rooter
{
/********************************************
* uses PrintWriter to write data to a file
* 
*  
* 
*
* @param arg unused
*********************************************/
    public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
       screen   = new PrintWriter(System.out); // creats a printwriter object        
                                               // write code to a file 
		 keyboard = new Scanner(System.in);       

       screen.println("Enter a number: ");
		 screen.flush();    
       
       
       while (keyboard.hasNext())
       {
          value = keyboard.nextDouble();
          result = Math.sqrt(value);

          screen.printf("The square root of " + value + " is " + result);
          screen.flush(); // gets rid of all the buffers 
			                 // in a chain of Writers and OutputStreams
          
          screen.println("Enter a number: ");       
        	 screen.flush();
       }

       screen.println("Done.\n");       
       screen.flush();
    }
    
}
