Assignemnt #70 Safe Squre Root

Code

/// Name: JJ Deng   
/// Period: 6
/// Program Name: Safe Square Root
/// File Name: SafeSquareRoots.java
/// Date Finished: 1/13/2015
  
import java.util.Scanner;

public class SafeSquareRoots
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
        int number;
        double root;
        System.out.println("SQUARE ROOT!");
        System.out.print("ENTER A NUMBER: ");
        number = keyboard.nextInt();
        
        while (number < 0)
        {
            System.out.println("You can't take square root of a negative number, silly.");
            System.out.print("TRY AGAIN: ");
            number = keyboard.nextInt();
        }
        root = Math.sqrt(number);
        System.out.println("The square root of " + number + " is" + root );
    }
}
        
  

Picture of the output

Assignment 74