Assignemnt #51 Number Guessing Game
Code
///Name: JJ Deng
///Period: 6
///Program Name: Number Guessing Game
///File Name: NumberGuessing.java
///Date Finished: 12/2/15
import java.util.Random;
import java.util.Scanner;
public class NumberGuessing
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int choice = 1 + r.nextInt(100), Number;
String response = "";
System.out.println("Time For You To Guess The Number :DDD");
System.out.println();
System.out.print("My Number is between 1-100, u guess it wrong u die ");
Number = keyboard.nextInt();
System.out.println();
if (choice == Number)
{
System.out.println("Nice! Your Survived, u lucky little **** !");
}
else
{
System.out.println("U dead brah but ima tell you my number anyways, it was "+ choice );
}
}
}
Picture of the output