Assignemnt #58: Guessing the number with Hi-Low Indications

Code

 /// Name: Sean Harrison
    /// Period: 7
    /// Program name:  OneShot
    /// File Name: OneShot.java
    /// Date Finished: 11/13/2015
    
import java.util.Random;
import java.util.Scanner;
public class OneShot
{
    public static void main( String[] args )
    {
    Random r = new Random();
    Scanner keyboard = new Scanner(System.in);
    
    int guess, x;
    x = 1 + r.nextInt(100);
    
    System.out.println( "I'm thinking of a number between 1-100. Try to guess it");
    guess = keyboard.nextInt();
    if ( guess == x )
    {
        System.out.println( "Congrats on guessing the correct number! " );
    }
    if ( guess <= x )
    {
        System.out.println( " The number you chose was too low. The correct number was " + x );
    }
    if ( guess >= x )
    {
        System.out.println( "The number you chose was too high. The correct number was " + x );
    }
    }
}
        
    
    
          
 

Picture of the output

Assignment 58