Assignemnt #65: Number-Guessing with a Counter

Code

    ///Name: Cassie
    ///Period: 6
    ///Program Name: Number-Guessing with a Counter
    ///File Name: counter.java
    ///Date Finished: 12/9/15
    
    import java.util.Random;
    import java.util.Scanner;
        
        class counting
        {
        	public static void main( String[] args )
        	{
        		Scanner keyboard = new Scanner(System.in);
                Random r = new Random();
                    
                int guess, choice = 1 + r.nextInt(10);
                int n = 0;
            	String response = "";
                        
                System.out.println( "I'm thinking of a number from 1 to 10." );
                System.out.print( "Your guess: " );
                guess = keyboard.nextInt();
                
                while ( guess != choice )
                {
                    System.out.println("\nIncorrect");
            		System.out.println( (n + 1) + ". Guess again: " );
                    n++;
            		guess = keyboard.nextInt();
                }
                
                if ( guess == choice )
                {
                    System.out.println( "Correct!" );
                }            
    		}
      }
    

Picture of the output

Assignment 65