Assignemnt #61: Keep Guessing

Code

    ///Name: Cassie
    ///Period: 6
    ///Program Name: Keep Guessing
    ///File Name: guessing.java
    ///Date Finished: 12/7/15
    
    import java.util.Random;
    import java.util.Scanner;
    
    class guessing
    {
    	public static void main( String[] args )
    	{
    		Scanner keyboard = new Scanner(System.in);
            Random r = new Random();
                
            int guess, choice = 1 + r.nextInt(10);
        	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.print("Guess again: ");
        		guess = keyboard.nextInt();
            }
            
            if ( guess == choice )
            {
                System.out.println( "Correct!" );
            }
        }
    }
        
    

Picture of the output

Assignment 61