Prog 55: A Number-Guessing Game
///Name: Ilana Levy
///Period: 5
///Program Name: A Number-Guessing Game
///File Name: guessingGame.java
///Date Finished: 9/21/2015
import java.util.Random;
import java.util.Scanner;
public class guessingGame
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner( System.in );
Random r = new Random();
int x = 1 + r.nextInt(10);
int guess;
System.out.println( "Im thinking of a number from 1 to 10.\n Your guess: " );
guess = keyboard.nextInt();
if ( x == guess)
{
System.out.println( "That's right! My secret number was " + x );
}
else
{
System.out.println( "Sorry, but I was really thinking of " + x );
}
}
}