import java.io.*;
import java.util.Scanner;
/***************************************************
 * Rooter.java
 * Uses PrintWriter to calculate the square root of
 * a number that is input into the program.
 * 
 * Krys Stultz
 * 1/10/07
 * Lab 4
 * Section 2
 *
 * @author - Krys Stultz
 * @version - v1.0
 **************************************************/

public class IO_stultzkm_Rooter
{
	/**
	 * main method calculates the square root
	 * of any numbers that are input
	 *
	 * @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);

       // Prompt user for input
       screen.println("Enter a number: ");
		 screen.flush();  
       
       // Get each number and calculate the square root       
       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();
    }    
}
