Assignment #55 A Number Guessing Game
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: ANumberGuessingGame
/// File Name: ANumberGuessingGame.java
/// Date Finished 11/24/2015
import java.util.Scanner;
import java.util.Random;
public class ANumberGuessingGame
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int guess, number;
number = 1 + r.nextInt(10);
System.out.println( "GIT REDY 2 PLY TEH WORST NUMBER GESSIN GAME EVARRRRR" );
System.out.println();
System.out.print( "Im thinkin of a number from 1-10. Tri 2 gess it: " );
guess = keyboard.nextInt();
System.out.println();
if ( guess == number )
{
System.out.println( "WUTTTT U GOYT tat it wus " + number + "!" );
}
if ( guess > number )
{
System.out.println( "HAHA UR DUM it twas numbr "+ number + "!" );
}
if ( guess < number )
{
System.out.println( "WAYY off u dum dum eat gum gum it twas numbr " + number + "!" );
}
}
}
Picture of the output
//