/*****************************
* Spencer Sayce 
* Section 1 
* 1/22/07
* Lab 4
*
* This class will be used as part
* of a lab exercise.  It will take 
* the square root of a given number
*******************************/

import java.io.PrintWriter;
import java.util.Scanner;
public class IO_saycese_Rooter
{
	/*****************************
	* This method will be used as part
	* of a lab exercise.  It will take 
	* the square root of a given number
	*******************************/
    public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
       screen   = new PrintWriter(System.out);       
       keyboard = new Scanner(System.in);
	     //Prints the message and fixes the auto flushing 
		 screen.println("Enter a number: ");    
		 screen.flush();
      
       //while there is keyboard input it will continue to find the square root of the input number
       while (keyboard.hasNext())
       {
          value = keyboard.nextDouble();
          result = Math.sqrt(value);

          screen.printf("The square root of " + value + " is " + result);
          screen.flush();
          
          screen.println("Enter a number: ");       
        	 screen.flush();
       }
	   //ends the program and flushes the PrintWriter
       screen.println("Done.\n");       
       screen.flush();
    }
    
}
