import java.io.*;
import java.util.Scanner;
/**===============================================
*   This class continuously uses the Scanner to
*   take in a number from the keyboard and uses
*   PrintWriter to print out it's square root.
*
*   @author Jonathan Spiker
*   @version 1
*
*   Date: 01-22-07
*   Lab: 4
*   Section: 3
==================================================*/

public class IO_spikerjl_Rooter
{
	/**===============================================
	*   This method gets an input number from the 
	*   keyboard and while there is an input following
	*   it takes that number and prints out the
	*   square root of it using PrintWriter.
	*
	*   @param args command line arguments not used
	==================================================*/
	
    public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
		 //initializes input and output objects
       screen   = new PrintWriter(System.out); //used to print to the screen
       keyboard = new Scanner(System.in);

       screen.println("Enter a number: ");  
		 screen.flush();   //flushes the output buffer
       
       //While there is another double value in the input, print
		 //that input's square root then ask for another 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();
       }

       screen.println("Done.\n");       
       screen.flush();
    } // end of main
    
} // end of class
