import java.util.Scanner;
import java.io.*;
/********************************************************************
* This program will teach IO methods using PrintWriter and Scanner
*
*	@author Joseph Claus
*	@version V1
*/
// Date: 1/22/07
// Section: 1
// Lab: Session 4

public class IO_clausjs_Rooter
{
  	 /***************************************
	 *	This is the main method where the program
	 *	takes place
	 */  
	 
	 public static void main(String[] args)
    {
       double          value, result;       
       PrintWriter     screen;       
       Scanner         keyboard;
       
       screen   = new PrintWriter(System.out);  //Intializes new PrintWriter object     
       keyboard = new Scanner(System.in);			//Initializes new Scanner object
    
		     
       screen.println("Enter a number: "); //Outputs a prompt to input a variable
		 screen.flush(); // necessary for PrintWriter method
       
       while (keyboard.hasNext())//This loop will iterate until the program is exitted
       {      
			 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");  //End of program     
       screen.flush();
    }
    
}
