The Worst Number-Guessing Game Ever
Code
/// Name: Rachel Smith
/// Period: 5
/// Program Name: The Worst Number-Guessing Game Ever
/// File Name: TheWorst.java
/// Date Finished: 11/6/2015
import java.util.Scanner;
public class TheWorst {
public static void main( String[] args ) {
Scanner keyboard = new Scanner(System.in);
int guess, number;
number = 7;
System.out.println( "Get ready to play THE WORST NUMBER GUESSING GAME EVERRR!" );
System.out.println();
System.out.print( "I'm thinking of a number from 1-10. Try to guess it: " );
guess = keyboard.nextInt();
System.out.println();
if ( guess == number ) {
System.out.println( "Impressive. You actually guessed it that it was " + number + "!" );
}
if ( guess > number ) {
System.out.println( "Loser. It was " + number + "!" );
}
if ( guess < number ) {
System.out.println( "Loser. It was " + number + "!" );
}
}
}
Picture of the output