Assignment #72 Again with the Number-Guessing

Code

    /// Name: Matthew Lorence
    /// Period: 5
    /// Program Name: Number Guessing Again
    /// File Name: NumberGuessingAgain.java
    
    import java.util.Scanner;
    import java.util.Random;
    
    public class NumberGuessingAgain
    {
        public static void main( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
            Random r = new Random();
            
            int number, guess, tries;
            number = 1 + r.nextInt(10);
            tries = 1;
            
            System.out.println("I have chosen a number between 1 and 10. Try to guess it.");
            
            do
            {
                System.out.print("Your guess: ");
                guess = keyboard.nextInt();
                if (guess==number)
                {
                    System.out.println("That's right! You're a good guesser.");
                    System.out.println("It only took you " + tries + " tries.");
                }
                else
                {
                    System.out.println("That is incorrect. Guess again. ");
                }
                tries++;
                
            }   while ( guess != number );
        }
    }       
        
        
        
    

Picture of the output

Assignment 72