Assignment #52 The Worst Number-Guessing Game Ever
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: The Worst Number-Guessing Game Ever
/// File Name: NumberGame.java
/// Date Completed: 10/29/15
import java.util.Scanner;
public class NumberGame {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int guess, answer;
answer = 7;
System.out.println("This is a number guessing game without an absurd and unnecessary number of capital letters and spelling/grammar errors.");
System.out.println();
System.out.print("I'm thinking of a number from 1 to 10. What is your guess? ");
guess = keyboard.nextInt();
System.out.println();
if (guess == 7) {
System.out.println("Nice job. You got it right. You got a 1 in 10 chance question right. It was probably more like 1 in 8 though since picking 1 or 10 would sound too obvious or easy so most people would pick something inbetween.");
}
else if (guess >= 1 && guess <= 10 && guess != 7) {
System.out.println("You got it wrong. Sucks. The correct number was 7.");
}
else {
System.out.println("You didn't even give a number in the range. Wow, that was pretty bad. Try again.");
}
}
}
Picture of the output