Assignemnt #52 and WorstGuessing
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: Forty-First Program
/// file name: WorstGuessing.java
/// date finished: 11/13/15
import java.util.Scanner;
public class WorstGuessing
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int answer, n;
n = 7;
System.out.println("Worst Guessing Game Ever!");
System.out.println("");
System.out.print("I'm thinking of a number between 1-10 can you guess it?");
answer = keyboard.nextInt();
if (answer == n)
{
System.out.println("No way you guessed it!");
}
else
{
System.out.println("Sorry you got it wrong the number was " + n);
}
}
}
Picture of the output