KeepGuessing

Code

import java.util.Random;
import java.util.Scanner;

public class KeepGuessing
{
	public static void main ( String[] args )
	{
        Scanner keyboard = new Scanner(System.in);
		int num;
        
        System.out.println( "pick number from 1-10" );
        num = keyboard.nextInt();
        
        Random r = new Random();

		int choice = 1 + r.nextInt(10);
		String response = "";
        
        while ( num != choice )
        {
            System.out.println( " TRY AGAIN " );
            num = keyboard.nextInt();
        }
        
    }
}

KeepGuessing

Assignment 61