Assignemnt #65 and Number Guessing with Counter

Code

      ///Name: Dakota Donahue
      ///Period: 5
      ///Project Name: Number Guessing with Counter
      ///File Name: NGWCounter.java
      ///Date: 1/12/2016
      
      import java.util.Scanner;
      import java.util.Random;
      
      public class NGWCounter
      {
          public static void main ( String[] args )
          {
              Scanner keyboard = new Scanner(System.in);
              Random r = new Random();
              
              int guess;
              int total = 0;
              
              int rN = 1 + r.nextInt(10);
              
              System.out.println( " I'm thinking of a number from 1 to 10 " );
              
              System.out.print( " Your guess: " );
              guess = keyboard.nextInt();
              total++;
                  
              while ( guess != rN )
              {
                  System.out.println( " That's incorrect, guess again. " );
                  guess = keyboard.nextInt();
                  total++;
              }
              if ( guess == rN )
              {
                  System.out.println( " That's correct, it took you " + total + " tries to guess correctly. " );
              }
          }
      }
    
ALettertoYourself