Project: Level Up the Java Menu App

Add a number guessing game to your Java menu app using input, loops, and random numbers.

You’ve built a menu app that greets users and tells jokes. Now let’s make it smarter and more interactive.

Add new menu options: Show a random number and play a number guessing game.

Menu options

  1. Greet

  2. Tell a joke

  3. Show a random number (1–100)

  4. Play a number-guessing game

  5. Exit

Requirements

In option 4, start a number-guessing game:

    • Use Random to generate a number between 1 and 10.

    • Ask the user to guess the number until they get it right.

    • After each guess, say “Too high,” “Too low,” or “Correct!”.

    • Return to the main menu once they guess correctly.

Get hands-on with 1400+ tech skills courses.