Assignment #61 and KeepGuessing

Code

      /// Name: Jason Kim
      /// Period: 7
      /// Program Name: KeepGuessing
      /// File Name: KeepGuessing.java
      /// Date Finished:11/2/15
      
      import java.util.Scanner;
      import java.util.Random;
      
      public class KeepGuessing
      {
          public static void main (String[] args)
          {
              Random r = new Random();
              Scanner keyboard = new Scanner(System.in);
              int secretNumber = 1 + r.nextInt(10), number;
              
              System.out.println("I have chosen a number from 1 to 10. Try to guess it.");
              System.out.print("Your guess: ");
              number = keyboard.nextInt();
              
              while ( number != secretNumber)
              {
                  System.out.println("That is incorrect. Guess again.");
                  System.out.print("Your guess: ");
                  number = keyboard.nextInt();
              }
                  System.out.println("That's right! You're a good guesser.");
          }
      }

    

Picture of the output

Assignment61