import java.io.PrintWriter;
import java.util.Scanner;
/***********************************************
 *	Finds the Square Root of an Inputted Number
 *
 * @author - Michael Siltz (Modified Code by E. Adams)
 * @version 2
 ************************************************/
// Date: January 22, 2007
// Section 1
// Lab 4
public class IO_siltzma_Rooter
{
   /********************************************
    * Asks for a number and while something is inputted,
	 * it looks for the next double and finds the square root
	 * of the number.
    *
    * @param args unused
    *********************************************/  
	 public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
       screen   = new PrintWriter(System.out);       
       keyboard = new Scanner(System.in);

       screen.println("Enter a number: ");    
       screen.flush(); // Flushes the buffer
       
       while (keyboard.hasNext())
       {
		 	 // Takes in the inputted value and finds the square root      
			 value = keyboard.nextDouble();
          result = Math.sqrt(value);
			 
			 // Prints the result of the square root of the inputted value
          screen.printf("The square root of " + value + " is " + result);
          screen.flush();
          
			 // Prompts for another number
          screen.println("Enter a number: ");       
        	 screen.flush();
       }

       screen.println("Done.\n"); // Prints that the program has ended       
       screen.flush();
    }
    
}
