OneShot

Code

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

public class OneShot
{
	public static void main ( String[] args )
	{
        Scanner keyboard = new Scanner(System.in);
		Random r = new Random();
        
        int num;

		int choice = 1 + r.nextInt(100);
		String response = "";
        
        System.out.println(" I'm thinking of a number from 1-100 can you guess it ");
        num = keyboard.nextInt();
        
        if ( choice == num )
        {
            System.out.println(" Wow you got it...to easy ");
        }
        else if ( choice > num )
        {
            System.out.println(" To low. It was actually " + choice );
        }
        else if ( choice < num )
        {
            System.out.println(" To high. It was actually " + choice );
        }
    }
}

OneShot

Assignment 58