Assignemnt # The Worst Number-Guessing Game Ever
Code
/// Name: Jake Johnson
/// Period: 7
/// Program Name: TheWorstNumberGuessingEver
/// File Name: TheWorstNumberGuessingEver.java
/// Date Finished: 11/30/2015
import java.util.Scanner;
public class TheWorstNumberGuessingEver
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
int secret, guess;
System.out.print("I bet you can't guess my secret number! But I will let you guess anyways: ");
guess = keyboard.nextInt();
secret = 5;
if (guess != secret)
{
System.out.println("Nope, it was " + secret + ".");
}
else
{
System.out.println("Yep, it was " + secret + ".");
}
}
}
Picture of the output