Assignemnt #61
Code
/// Name: Holden Ganch
/// Period: 7
/// Program Name: sixty first Program
/// File Name: keep.java
/// Date Finished: 12/8/2015
import java.util.Random;
import java.util.Scanner;
public class keep
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int y, x = 1 + r.nextInt(10);
String response = "";
System.out.println("Pick a number between 1 and 10");
System.out.print("Your guess: ");
int entry = keyboard.nextInt();
while ( entry != x )
{
System.out.println("\n That is incorrect. pleese do guess again");
System.out.print("Your guess: ");
entry = keyboard.nextInt();
}
System.out.println("\n congrats you got it right.");
}
}
Picture of the output