import java.io.*;//Part 2 Question 4
import java.util.Scanner;//Part 2 Question 7
/***********************************************
 * Take the square root of a number given through
 * user input.
 *
 * @author - Vicente Rosa
 * @version - V2
 ************************************************/
 /* Date: January 22, 2007
 /  Section 3
 /  Lab 4
 /
 /  References and Ackknowledgements: I have recieved
 /  no help on this programming assignment
 /  *Lab originially by Elizabeth Adams
 /***********************************************/

public class IO_rosavj_Rooter
{

	/********************************************
	 * Main method will ask for user input on what number to take
	 * the square root of.
	 *
	 * @param User input through the Scanner object
	 * @return output using the PrintWriter class
	 *********************************************/
    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(); //Allows the PrintWriter object to output by running through the buffer
       
       while (keyboard.hasNext())
       {
          value = keyboard.nextDouble();
          result = Math.sqrt(value);

          screen.printf("The square root of " + value + " is " + result);
          screen.flush();
          
          screen.println("\nEnter a number: ");       
        	 screen.flush();
       }

       screen.println("Done.\n");       
       screen.flush();
    }
    
}
