Assignemnt #56

Code

/// Name: Connor Siri
/// Period: 7
/// Program Name: Guess
/// File Name: Guess.java
/// Date Finished: 10/27/2015

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

public class Guess
{
	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("Choose a number from 1-10 ");
        System.out.print("> ");
        y = keyboard.nextInt();
        
        if ( x == y )
        {
        System.out.println("You got it right good job, it was " + x);
        }
        if ( x != y )
        {
        System.out.println("You got it wrong you suck, it was " + x);
        }
        }
        }

        
    

Picture of the output

Assignment3.html