// Import the io class in order to use PrintWriter
import java.io.*;
// Import the util class to use Scanner
import java.util.*;

/**********************************************************************
 * @Trevor Spalt
 * @Lab 4
 * @1/22/07
 * @Section 06
 *********************************************************************/

public class IO_spaltts_Rooter
{
	/******************************************************************
    * Method purpose: This method is used to get practice with
	 * the PrintWriter method. I will correct the code that is given
	 * and explain each correction I made 
    *****************************************************************/
	 
    public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
       screen   = new PrintWriter(System.out);       
       keyboard = new Scanner(System.in);
			
		 // Use PrintWriter in order to output to the user
       screen.println("Enter a number: ");    
		 // User flush in order to get a new line in screen
       screen.flush();
       
       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();
    }
    
}
