Assignment #72 and Again With Number Guessing
Code
///Name: Mark Katz
///Period: 6
///Program Name: Again with Number-Guessing
///File Name: againnmbr.java
///Date Finished: 10/28/15
import java.util.Random;
import java.util.Scanner;
public class againnmbr
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int choice = 1 + r.nextInt(10), s, count=0;
String response = "";
System.out.println("LE WURST GAM EVR");
System.out.println("");
System.out.println("iM TINKIN' UF A NUMBA BTWEN 1-10. GES ITT. ");
s = keyboard.nextInt();
System.out.println("");
count++;
do
{
System.out.println("That is incorrect. Please try again." );
s = keyboard.nextInt();
System.out.println("");
count++;
} while ( s!= choice );
System.out.println("Congrats! You got it right. It took you " + count + " times." );
}
}
Picture of the output