package net.bunnie.dos; import java.util.Random; import net.bunnie.*; public class RandomN { public static void main(String[] args) { Random random = new Random(); int ranNum = random.nextInt(100) + 1; KeyboardReader r = new KeyboardReader(); int guess = 0; int count = 0; Echo.e("I am thinking of a number between 1 and 100.\n"); while (guess != ranNum) { Echo.e("Guess my number: "); guess = r.readInt(); count++; if (ranNum < guess) { Echo.e("Too high.\n"); } if (ranNum > guess) { Echo.e("Too low.\n"); } if (ranNum == guess) { Echo.e("You guessed my number! You're so smart...\nAnd it only took you " + count + " tries!\n"); } } } }