Project 1 · Java Programming Internship @ DecodeLabs
A crash-proof, logic-driven number guessing engine built with Core Java
This is my first project from the Java Programming Internship at DecodeLabs. While it looks like a simple game on the surface, it's really an exercise in clean logic, robust state management, and writing crash-proof software.
The game generates a random number between 1 and 100, gives you limited attempts to guess it, provides High/Low feedback after each guess, tracks your score across multiple rounds, and never crashes — no matter what you type.
| Feature | Description |
|---|---|
| 🎲 Random Number Generation | Fresh random number (1–100) every round using java.util.Random |
| 📥 User Input Handling | Real-time input via java.util.Scanner with full validation |
| 🔁 High / Low Feedback | Instant directional hints after every guess |
| ⏳ Attempt Limiter | Fixed number of attempts per round — run out and it's Game Over |
| 🏆 Score Tracking | Persistent score across multiple rounds in one session |
| 🔄 Multiple Rounds | Play again without restarting the program |
| 🛡️ Input Validation | try-catch handles InputMismatchException — completely crash-proof |
java.util.Random → Stochastic number generation
java.util.Scanner → Stream-based user input capture
while loop → Game state management per round
if-else conditionals → High / Low feedback logic
try-catch block → InputMismatchException handling
do-while loop → Session persistence (multiple rounds)
- Java JDK 8 or higher installed
- A terminal / command prompt
# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/number-guessing-game.git
# 2. Navigate into the project directory
cd number-guessing-game
# 3. Compile the Java file
javac NumberGuessingGame.java
# 4. Run the program
java NumberGuessingGame==========================================
Welcome to the Number Guessing Game!
==========================================
I'm thinking of a number between 1 and 100.
You have 7 attempts. Good luck!
Attempt 1/7 → Enter your guess: 50
📉 Too Low! Try higher.
Attempt 2/7 → Enter your guess: 75
📈 Too High! Try lower.
Attempt 3/7 → Enter your guess: 63
🎉 Correct! You guessed it in 3 attempts!
Your Score: 1 | Play again? (yes/no): yes
number-guessing-game/
│
├── NumberGuessingGame.java # Main game logic
└── README.md # Project documentation
"A working game is good. A crash-proof game is professional." — DecodeLabs
This project taught me that programming is fundamentally about logic, not just syntax. Key takeaways:
- Managing program state across loops and rounds
- Handling edge cases gracefully without crashing
- Using exception handling as a design tool, not an afterthought
- Writing code that is predictable and reliable for the end user
Ubaidullah Waheed Java Intern @ DecodeLabs
This project is open source and available under the MIT License.