Assignemnt # and

Code

      ///Name: Dakota Donahue
      ///Period: 5
      ///Project Name:
      ///File Name:
      ///Date: 3/10/2016
      
      import java.util.Scanner;
      import java.util.Random;
      
      public class AgainNGWCounter
      {
          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++;
                  
              do
              {
                  System.out.println( " That's incorrect, guess again. " );
                  guess = keyboard.nextInt();
                  total++;
              } while ( guess != rN );
              
              if ( guess == rN )
              {
                  System.out.println( " That's correct, it took you " + total + " tries to guess correctly. " );
              }
          }
      }
      
    
ALettertoYourself