Assignemnt #59

Code

/// Name: Connor Siri
/// Period: 7
/// Program Name: One
/// File Name: One.java
/// Date Finished: 10/30/2015

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

public class One
{
	public static void main ( String[] args )
	{
		Random r = new Random();
        Scanner keyboard = new Scanner(System.in);
        
        int y, x = 1 + r.nextInt(100);
        
        System.out.println("I'm thinking of a number between 1-100. try and guess it");
        System.out.print("> ");
        y = keyboard.nextInt();
        
        if ( x == y)
        {
        System.out.println("I cant believe you got that is was " + x);
        }
        if ( x > y )
        {
        System.out.println("Sorry you are too low it was " + x);
        }
        if ( x < y )
        {
        System.out.println("Sorry you are too high it was " + x);
        }
        }
        }
        

        
    

Picture of the output

Assignment6.html