package edu.bloomu.ch5a;

import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;

/**
 * Prompts the user to guess a random number between 1 and 10 inclusive.
 * 
 * @author Drue Coles
 */
public class HiLo {

    public static void main(String[] args) {
        
        ThreadLocalRandom rand = ThreadLocalRandom.current();
        final int secret = rand.nextInt(1, 11);
        System.out.print("Guess my secret number (1-10): ");
        
        Scanner in = new Scanner(System.in);
        int guess = in.nextInt();
        
        System.out.printf("You guessed %d. %n", guess);
        System.out.printf("My secret number was %d.%n", secret);
        
        if (guess < secret) {
            System.out.println("Your guess was too low.");
        } else if (guess > secret) {
            System.out.println("Your guess was too high.");
        } else {
            System.out.println("Your guess was correct.");
        }
    }
}