Assignment #65 Number Guessing With Counter
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: NumberGuessingWithCounter
/// File Name: NumberGuessingWithCounter.java
/// Date Finished 12/10/2015
import java.util.Scanner;
import java.util.Random;
public class NumberGuessingWithCounter
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int Guess, Number, Tries;
Number = 1 + r.nextInt(10);
System.out.println( "GIT REDY 2 PLY TEH WORST NUMBER GESSIN GAME EVARRRRR" );
System.out.println();
System.out.println( " Im thinkin of a number 1-10. Tri 2 ges it. " );
System.out.print( "Your guess: " );
Guess = keyboard.nextInt();
Tries = 1;
while ( Guess != Number )
{
System.out.println( "EHHHH incorrect . ges again" );
System.out.print( "Your guess: " );
Guess = keyboard.nextInt();
Tries++;
}
System.out.println( "WUTTT YOU GOT IT" );
System.out.println( "LOL took u " + Tries + " Tries." );
}
}
Picture of the output
//