import java.io.PrintWriter;//imports PrintWriter from io package
import java.util.Scanner;
/**============================================================== 
 * Computing often involves the need to process input from a 
 * file and output data to a file. This lab will provide practice 
 * in reading from and writing to files.
 *
 * @author  Toufic Arabi
 * @version  1
 * 
//==============================================================  */
// Date:  01/22/2007
// Section 3
// Lab 4

public class IO_arabitm_Rooter
{
    public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
		 // creates a new PrintWriter object
       screen   = new PrintWriter(System.out);
		 
		 // creates a new Scanner object       
       keyboard = new Scanner(System.in);
		
		 /*pass the String Enter a number: to the
		 *println method of screen PrintWriter object
		 *and stores it in the buffer memory*/
		 
       screen.println("Enter a number: ");    
       
		 // prints the buffer's memory on the screen
		 screen.flush();
       
   	// tests if the input entered is an integer    
		 while (keyboard.hasNext())
       {
          value = keyboard.nextDouble();
          result = Math.sqrt(value);
			
			// prints the square root of the input from the buffer's memory
          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 main
    
}//end class
