import java.util.*;// imports all the utilities
import java.io.*;// imports all the input output 
/***************************************************************************
* this class takes a number and outputs its square root until terminated by 
* the user
*
* Brian Demarkis
* 1/22/07
* I/O Lab
* Section 2
*
*@author Brian DeMarkis
*@version v1
***************************************************************************/
public class IO_demarkbc_Rooter
{
/****************************************************************************
* this is the main method and is used to ask for an input value and does the
* calculation to get teh square root of that value and then prints the value 
* and the square root and executes til ended by the user 
*
* @ param not used 
*****************************************************************************/  
	 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: "); // prints the message on the screen  
       screen.flush();
       
       while (keyboard.hasNext())
       {
          value = keyboard.nextDouble();// assigns the value variable to the nextdouble entered
          result = Math.sqrt(value);// gets the result by using the Math.sqrt method to get teh square root of value

          screen.printf("The square root of " + value + " is " + result);// prints the value and result
          screen.flush();
          
          screen.println("Enter a number: ");// asks for the next number and loops continuously until the uder ends the program       
        	 screen.flush();
       }

       screen.println("Done.\n");       
       screen.flush();
    }
    
}
