Assignemnt 61 and Keep Guessing

Code

    /// Name: Xinting Chen
    /// Period: 7
    /// Program Name: KeepGuessing
    /// File Name: KeepGuessing.java
    /// Date Finished: 12/4/2015
  
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.Random;

       public class KeepGuessing
	   {
		   public static void main(String[] args)
		   {
			   Scanner keyboard = new Scanner(System.in);

			   Random r = new Random();

			   int SecretNumber = 1 + r.nextInt(10);
			   int guess = 0;
			   System.out.println("I have chosen a number between 1 and 10. Try to guess it.");
			   System.out.println();
               System.out.print("Your guess: ");
               guess = keyboard.nextInt();
			 
               
               while (guess != SecretNumber)
               {
                   System.out.println("That is incorrect. Guess again.");
                   SecretNumber = keyboard.nextInt();
		       }
               
               System.out.println(" That is right! You're a good guesser!" );
	       }
       }



    

Picture of the output

Assignment 61