2

BUILD A HI-LO GUESSING GAME APP!

Image

Let’s begin by coding a fun, playable game in Java: the Hi-Lo guessing game. We’ll program this game as a command line application, which is just a fancy way of saying it’s text based (see Figure 2-1). When the program runs, the prompt will ask the user to guess a number between 1 and 100. Each time they guess, the program will tell them whether the guess is too high, too low, or correct.

Image

Figure 2-1: A text-based Hi-Lo guessing game

Now that you know how the game works, all you have to do is code the steps to ...

Get Learn Java the Easy Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.