Assignment #74 and Safe Square Root

Code

                        /// Name: Graham Pollock
                        /// Period: 5
                        /// Program Name: Safe Square Root
                        /// File Name: SafeSquareRoot.java
                        /// Date Finished: 01/37/2016/

    import java.util.Scanner;
        
        public class SafeSquareRoot
        {
            public static void main(String[] args)
            {
                Scanner keyboard = new Scanner(System.in);
                 
                double input, sroot;
                
                System.out.println("SQUARE ROOT!");
                System.out.print("Enter a number: ");
                input = keyboard.nextDouble();
                
                while (input < 0)
                {
                    System.out.println("You can't take the square root of a negative number!");
                    System.out.print("Try again: ");
                    input  =keyboard.nextDouble();
                }
                
                sroot = Math.sqrt(input);
                
                System.out.println("the square root of " + input + " is " + sroot );
            }
        }
    
    

Picture of the output

Assignment