Assignment #52 and The Worst Number-Guessing Game Ever
Code
/// Name: Lauren Baird
/// Period: 7
/// Program Name: The Worst Number-Guessing Game Ever
/// File Name: GuessingNumbers.java
/// Date Finished: 10/26/2015
import java.util.Scanner;
public class GuessingNumbers
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int guess;
int number = 7;
System.out.println( "Let's play a game!" );
System.out.println();
System.out.print( "I'm thinking of a number from 1-10. Try and guess. " );
guess = keyboard.nextInt();
if (guess == number)
{
System.out.println( "You got it! But there isn't a prize for winning, don't get too excited." );
}
else
{
System.out.println( "Nope. It was 7! Better luck next time, m8." );
}
}
}