Assignemnt #61 and Guessing Game Upgrade

Code

///Name: Ben Borglin
///Period: 6
///Program name: Guessing Game upgrade
///file name: GuessingGame2.java
///Date Finsihed: 10/20/15

import java.util.Scanner;
import java.util.Random;

public class GuessingGame2
{
    public static void main ( String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        Random r = new Random();
        int choice, x;
        x = 1 + r.nextInt(10);
        
        
        System.out.println("Im thinking of a number between 1 to 10.");
        System.out.print("Your Guess: ");
        choice = keyboard.nextInt();
        
        while ( choice != x )
        {
            System.out.println("Sorry that was incorrect ... Try again.");
            System.out.print(">");
            choice = keyboard.nextInt();
        }
        
        System.out.println("\nYou're right! Nice guess.");
        
        
            
     }
}      
    

    

Picture of the output

Assignment 61