Assignemnt #55
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: NumberGuess Program
/// File Name: NumberGuess.java
/// Date Finished: 9/9/2015
import java.util.Random;
import java.util.Scanner;
public class NumberGuess
{
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int guess;
int rng = 1 + r.nextInt(10);
System.out.println("I'm thinking of a number from 1 to 10.");
System.out.println("I BET JA CAWNT GESS IT!!!");
System.out.print("> ");
guess = keyboard.nextInt();
if (guess == rng) {
System.out.println("WOW YOU GOT IT!! WAT ARE DA CHANCES!!!!");
}
else {
System.out.println("HAHA TOLDJA THE NUMBER WAS " + rng + " YOU OH ME 5 BUCKS");
}
}
}
Picture of the output