/***********************************************
 * The Rooter class prompts the user for some 
 * numbers and outputs the square root of the
 * numbers
 * 
 * @author Kristopher Kalish
 * @version 1 - January 22th, 2007
 * 
 * Lab 4
 * Section 1 
 * 
 ************************************************/
 /*
  *  References and Acknowledgements: I have recieved
  *  no unauthorized help on this assignment.
  *
  */
import java.io.PrintWriter;
import java.util.Scanner;

public class IO_kalishkl_Rooter
{
	/**
	 * main() performs all of the operations for this class
	 * 1) Prompt
	 * 2) Output
	 * 3) Loop
	 */
    public static void main(String[] args)
    {
	    // value is the double form of the input
		 // result is the square rooted input
       double          value, result; 
       PrintWriter     screen;        // for writing to screen
       Scanner         keyboard;      // for grabbing keyboard input
       
       screen   = new PrintWriter(System.out);       
       keyboard = new Scanner(System.in);
       
		 // A simple prompt
       screen.println("Enter a number: ");    
       screen.flush();  // have to update the screen for prompt to show up		 
		 // Loop until all numbers have been found and processed
       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();
    }
    
}
