Assignemnt #58 and One Shot Guessing

Code

    ///Name: Daniel Tiffany- Appleton
    ///Period: 7
    ///Program Name: One Shot Guessing
    ///Fill Name: OneShotGuessing
    ///Date Finished: 11/16/15
    
    import java.util.Random;
    import java.util.Scanner;
    
    public class OneShotGuessing
    {
        public static void main( String [] args )
        {
        
            Scanner keyboard = new Scanner(System.in);
            Random r = new Random();
            
            int answer, guess;
            
            System.out.println( "I'm thinking of a number between 1-100. What is it?");
            System.out.print( "Your guess ");
            guess = keyboard.nextInt();
                
            answer = 1 + r.nextInt(100);
            
            if ( guess == answer )
            {
                System.out.println( "That is correct, how did you get it. Did you cheat!" );
            }
            
            else if ( guess > answer )
            {
                System.out.println( "Sorry that is incorrect, you were too high. The number was " + answer );
            }
            
            else if ( guess < answer )
            {
                System.out.println( "Sorry that is incorrect, you were too low. The number was " + answer );
            }
        }
    }


    

Picture of the output

Assignment 58