Assignment #65 and Number Guessing With A Counter

Code

    /// Name: Tim Chuang
/// Period: 7
/// Program Name: Number Guessing With A Counter
/// File Name: NumberGuessingWithACounter.java
/// Date Finished: 12/15/2015

import java.util.Scanner;

    import java.util.Random;

public class NumberGuessingWithACounter
{
    public static void main ( String[] args )
	{
		Random r = new Random();
        int randomNumber, guessNumber, tries;
        randomNumber = 1 + r.nextInt(10);
        tries = 0;
        
        Scanner keyboard = new Scanner(System.in);
        
        System.out.println("Whats a number between 1 and 10?");
        System.out.println("Guess ");
        System.out.print("> ");
        guessNumber = keyboard.nextInt();
        tries++;
        
        while ( guessNumber != randomNumber )
        {
            System.out.println("lol nope try again");
            System.out.print("> ");
            guessNumber = keyboard.nextInt();
            tries++;
        }
        if ( guessNumber == randomNumber )
        {
            System.out.println("gg bruv it only took you " + tries + " tries.");
        }
    }
}

    

Picture of the output

Assignment 65