Assignment #61 and Keep Guessing

Code

                        /// Name: Graham Pollock
                        /// Period: 5
                        /// Program Name: Keep Guessing
                        /// File Name: KeepGuessing.java
                        /// Date Finished: 09/12/2015/
    import java.util.Random;
        import java.util.Scanner;
        
        public class KeepGuessing
        {
            public static void main(String[] args)
            {
                Random r = new Random();
                Scanner keyboard = new Scanner(System.in);
                
                int guess, snumber;
                
                snumber = 1 + r.nextInt(10);
                
                System.out.println("I'm thinking of a number between 1-10. Try to guess it!");
                System.out.print("> ");
                guess = keyboard.nextInt();
                System.out.println("");
                
                while (guess != snumber)
                {
                    System.out.println ("Wrong, try again!");
                    System.out.print("> ");
                    guess = keyboard.nextInt();
                    System.out.println("");
                }
                
                System.out.println("You got it right! The Number Was " + snumber );
            }
        }
    

Picture of the output

Assignment