import java.lang.Math;
import java.util.Scanner;
public class NumberGuess {
private int answer;
private int guess;
Scanner in = new Scanner(System.in);
public NumberGuess() {
this.answer = (int) Math.floor(Math.random()*10 + 1);
System.out.println(answer);
}
public void play() {
while (answer != guess) {
this.getGuess();
}
in.close();
}
public void getGuess() {
System.out.print("Guess a number 1-10: ");
this.guess = in.nextInt();
System.out.println(this.guess);
if (this.guess > this.answer) {
System.out.println("too high");
} else if (this.guess < this.answer) {
System.out.println("too low");
} else {
System.out.println("congrats");
}
}
public static void main(String[] args) {
NumberGuess num = new NumberGuess();
num.play();
}
}