Assignment #52 and The Worst Number-Guessing Game Ever!
Code
/// Name: Brendan Baird
/// Period: 6
/// Program Name: The Worst Number-Guessing Game Ever!
/// File Name: NumberGuessing.java
/// Date Finished: 10/26/2015
import java.util.Scanner;
public class NumberGuessing
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int secretNumber = 2;
int guess;
System.out.println("Would you like to play a game?... I don't care!");
System.out.println();
System.out.println("Try to guess a number between 1 and 10. C'mon guess! ");
guess = keyboard.nextInt();
System.out.println();
if (guess == secretNumber)
System.out.println("Wow! You are pro because I was thinking of " + secretNumber + "!");
else
System.out.println("Wrong! The number I was thinking of was " + secretNumber + "!");
}
}
Picture of the output