Assignemnt #52 The Worst Number-Guessing Game Ever

Code

    Name: Iaroslav Titov
    Period: 7
    Project Name: WNGGE
    File Name: WNGGE.java
    Date: 10/21/2015
    
import java.util.Scanner;
import java.util.InputMismatchException;

       public class WNGGE
	   {
		   public static void main(String[] args)
		   {
			   Scanner keyboard = new Scanner(System.in);

			   byte SN = 2;
				byte guess = 0;
			   System.out.println("Try to guess the secret number from 1 to 10!!!");
			   System.out.println();

			   try
			   {
				   System.out.print("Your guess is: ");
				   guess = keyboard.nextByte();
			   }
			   catch(InputMismatchException e)
			   {
				   System.out.println("WRONG INPUT!!!");
				   guess = 0;
			   }

			   if (guess == SN) System.out.println("You guessed!!! The number is "+SN+".");
				else System.out.println("You are wrong!!! The number is " + SN + ".");
		   }
	   }

    

Picture of the output

Assignment 49