/*****************************************************
 *  This class is designed to learn how to work with  
 *	 the I/O files in Java
 * 
 * @author: Elizabeth Adams
 * @version 1
 * 
 ******************************************************/
 //Alexander Alarif
 //1/22/07
 //Lab 4
 //Section 2
 
			
import java.io.*;				//Imports the io functions
import java.util.*;			//Imports the util functions.
public class IO_alarifac_Rooter
{
    public static void main(String[] args)
    {
	 		//The variables declared that will display what will be used in the
			//square root method
       double          value, result;  			     
       PrintWriter     screen;       
       Scanner         keyboard;			
       
		 //This instaniates PrintWriter and the Scanner objects
       screen   = new PrintWriter(System.out);       
       keyboard = new Scanner(System.in);

		
		//This asks the user to enter a number using PrintWriter.
       screen.println("Enter a number: ");
		 
		 //Allows the screen object to read a new line and the user to enter a number.
		 screen.flush();
		   
       
       //Goes through a while loop stating that if the value of keyboard is
		 //true.
       while (keyboard.hasNext())
       {
		 		//Takes in a keyboard input of value and stores it in a double
          value = keyboard.nextDouble();
			 
			 	//Uses the square root method using the parameter value and
				//stores it in result		
          result = Math.sqrt(value);

				//Print formats and displays the variables value and result
          screen.printf("The square root of " + value + " is " + result);
			 
			 //Allows the screen object to read a new line
          screen.flush();
          
			 //Prints out a new line for the object screen
			 screen.println();
			 
			 
			 //Asks the user again to enter a number
          screen.println("Enter a number: "); 
			 
			 //Allows the user to be able to enter in a number or text with the screen object      
        	 screen.flush();
       }
			
			//Tells the user when they are done.
       screen.println("Done.\n");
		 
		 //Allows the user to enter other data when done with the program       
       screen.flush();
    }
    
}
