Assignment 55

 import java.util.Scanner;
 import java.util.Random;
 
 public class GuessingGame
 {
     public static void main( String[] args )
     {
         Scanner keyboard = new Scanner(System.in);
         Random r = new Random();
         int answer, guess;
         answer = 1 + r.nextInt(10);
         guess = 0;
         
         System.out.print("I'm thinking of a number from 1 to 10.\nyour guess: ");
         guess = keyboard.nextInt();
         
         if (guess == answer)
             System.out.println("\nThat's right!  My secret number was " +guess+ "!");
         else
             System.out.println("\nSorry, but I was really thinking of " +answer+ "!");
     }
 }