Assignemnt 72 and Again With The Number-Guessing

Code

    /// Name: Xinting Chen
    /// Period: 7
    /// Program Name: Again With The Number Guessing
    /// File Name: AgainWithTheNumberGuessing.java
    /// Date Finished: 12/15/2015
  
    
import java.util.Random;
import java.util.Scanner;
    
public class AgainWithTheNumberGuessing
{
    public static void main(String[] args)
    {
        Scanner keyboard= new Scanner(System.in);
        Random r = new Random();
        int guess=0, attempts= 0, SecretNumber = 1 + r.nextInt(10);
        
            
        System.out.println( "I have chosen a number between 1 and 10" );
        System.out.print(" Your guess: ");
        guess = keyboard.nextInt();
        attempts++;
        
        do
        {
            
        System.out.println( "That's incorrect. Guess again." );
        System.out.print(" Your guess: ");
        guess = keyboard.nextInt();
        attempts++;
            
        }
        while ( guess!= SecretNumber);
        System.out.println( "That's right! You're a good guesser. It only took you " + attempts + "tries. ");
    }
}



    

Picture of the output

Assignment 72