Assignemnt #58 and One Shot hi-low

Code

///Name: Ben Borglin
///Period: 6
///Program name: One Shot Hi-Lo
///file name: OneShot.java
///Date Finsihed: 10/19/15

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

public class OneShot
{
    public static void main( String[] args )
    {
        int guess;
        
        Random r = new Random();
        Scanner keyboard = new Scanner(System.in);
        
        int x = 1 + r.nextInt(100);
        
        System.out.println("I am thinking of a number between 1-100. Try and guess it.");
        System.out.println(">");
        guess = keyboard.nextInt();
        
        if ( guess == x )
        {
            System.out.println("You guess right!");
        }
        else if ( guess >= x )
        {
            System.out.println("Sorry you were a little high");
        }
        else if ( guess <= x )
        {
            System.out.println("Sorry you were a little low");
           
        }
        System.out.println("I was thinking of " + x );
    }
}
        
        
        
        
    
    

    

Picture of the output

Assignment 58