Assignemnt #52 The Worst Number-Guessing Game Ever!
Code
/// Name: Brendan Miller
/// Period: 5
/// Program Name: The Worst Number-Guessing Game Ever!
/// File Name: NumberGuessing.java
/// Date Finished: 11/26/2015
import java.util.Scanner;
public class NumberGuessing
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int secretNumber = 9;
int guess;
System.out.println("We gonna playa game now!");
System.out.println();
System.out.println("Try to guess a number between 1 and 10. I dare you! ");
guess = keyboard.nextInt();
System.out.println();
if (guess == secretNumber)
System.out.println("Woah! You are boss cuz I was thinking of " + secretNumber + "!");
else
System.out.println("Lame! You suck. I was thinking of " + secretNumber + "!");
}
}
Picture of the output