Assignemnt #55 and A Number-Guessing Game
Code
/// Name: Tristan Chung
/// Period: 5
/// Program Name: Guessing Game
/// File Name: GuessingGame.java
/// Date Finished: 11/16/2015
import java.util.Random;
import java.util.Scanner;
public class GuessingGame
{
public static void main( String [] args)
{
Random r = new Random();
int number, guess;
number = 1 + r.nextInt(10);
Scanner keyboard = new Scanner(System.in);
System.out.println("Let's play a Guessing Game!");
System.out.println();
System.out.println("Im thinking of a number between 1-10, try to guess it!");
guess = keyboard.nextInt();
if (guess == number )
System.out.println(" See, this game is easy!" );
else System.out.println( "Wow your terrible at this game. This was my number, " + number + ".");
}
}e>
Picture of the output