import java.io.*;
import java.util.Scanner;
/********************************************************************
 * This program gives practice with using file IO.  The program
 * prompts the user for a number.  The program then takes the square
 * root of the number and outputs it.  The program will run until
 * the user terminates using the comamnd: Ctrl + Z.
 *
 * @author - Sean Combs
 * @version - Version 1
 *	Date: 1/22/2007
 *	Section 001
 *	Lab 4
*********************************************************************/

public class IO_combssm_Rooter
{
    public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
		 //Initializes objects used for IO
       screen   = new PrintWriter(System.out);       
       keyboard = new Scanner(System.in);
		 
		 //Prompts user to enter a number
       screen.print("Enter a number: ");
		 screen.flush();       
       
		 //Runs the loop until the keyboard stream is ended
       while (keyboard.hasNext())
       {
		    //Assigns the square root of the inputted number to result
          value = keyboard.nextDouble();
          result = Math.sqrt(value);

			 //Outputs the value and its sqaure root
          screen.printf("The square root of " + value + " is " + result);
          screen.flush();
          
			 //Prompts the user for a number again
          screen.println("Enter a number: ");       
        	 screen.flush();
       }
		 
		 //States the program has ended normally
		 screen.println("Done.\n");       
       screen.flush();
		 
    } //end main
    
} //end Rooter
