0% found this document useful (0 votes)
2 views14 pages

Number Guessing Game Project in Java

The Number Guessing Game is an interactive program that challenges players to guess a randomly selected number within a set range, enhancing logical thinking and decision-making skills. The project illustrates key programming concepts such as loops, conditionals, and random number generation, making it an excellent tool for learning algorithmic problem-solving. It serves various applications in programming education, coding practice, and entertainment.

Uploaded by

dsreeman2023
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views14 pages

Number Guessing Game Project in Java

The Number Guessing Game is an interactive program that challenges players to guess a randomly selected number within a set range, enhancing logical thinking and decision-making skills. The project illustrates key programming concepts such as loops, conditionals, and random number generation, making it an excellent tool for learning algorithmic problem-solving. It serves various applications in programming education, coding practice, and entertainment.

Uploaded by

dsreeman2023
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SREYAS INSTITUTE OF ENGINEERING & TECHNOLOGY

(AUTONOMUS)
(Approved by A.I.C.T.E.,New Delhi., Affiliated to JNTUH Hyderabad, Accredited by NAAC ‘A’ Grade & NBA)
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING(AI&ML)

OOPS Through JAVA


Project on
NUMBER GUESSING GAME

Presented by
[Link]-24VE1A6633
[Link]-24VE1A6606
[Link] Chandana-24VE1A6612
[Link]-24VE1A6650

19/11/2025 NUMBER GUESSING GAME 1


Abstract
NUMBER GUESSING GAME
The number guessing game is a simple yet engaging interactive
program designed to test players’ logical thinking and decision-
making skills. In this game, the computer randomly selects a
number within a predefined range, and the player attempts to
guess it through successive trials. After each guess, the system
provides feedback indicating whether the guessed number is
higher, lower, or correct, allowing players to refine their guesses
strategically. The project demonstrates fundamental programming
concepts such as loops, conditionals, random number generation,
and user input handling. This game serves as an excellent
introductory exercise for learning algorithmic problem-solving
and control structures in programming.

Keywords:Number guessing, Randomization, User interaction,


Algorithm, Programming logic
19/11/2025 NUMBER GUESSING GAME 2
Algorithm
• Step 1: Start the program.
• Step 2: Initialize Scanner, Random, and set playAgain = true.
• Step 3:While playAgain is true:
a. Ask player to choose difficulty (Easy, Medium, Hard).
b. Set range (maxNumber) based on choice.
c. Generate a random numberToGuess within the range.
d. Set attempts = 0, maxAttempts = 5, hasGuessed = false.
e. While attempts < maxAttempts and not guessed:
• Step 4: Get user’s guess.
• Step 5: If correct → congratulate and break.
• Step 6: Else show “Too high” or “Too low”.
• Step 7: Increment attempts.
a. If not guessed, show the correct number.
b. Ask if the player wants to play again.
c. If answer ≠ “yes”, set playAgain = false.
• Step 7: Display goodbye message.
• Step 8: End.
19/11/2025 NUMBER GUESSING GAME 3
Flowchart

19/11/2025 NUMBER GUESSING GAME 4


CODE

19/11/2025 NUMBER GUESSING GAME 5


OUTPUT

19/11/2025 NUMBER GUESSING GAME 8


Advantages
•Improves logical thinking and problem-solving
skills.
•Teaches basic programming concepts (loops,
conditionals, random numbers).
•Fun, interactive, and easy to modify.
•Useful for debugging and learning input/output
handling.

19/11/2025 NUMBER GUESSING GAME 12


Applications
•Used in programming education and coding
practice.
•Basis for simple games and AI guessing
algorithms.
•Helpful in logic training, coding workshops, and
entertainment apps.
Conclusion

• The Number Guessing Game is an enjoyable and


interactive way to test a player’s guessing ability
while improving logical thinking. It provides both fun
and learning by challenging users to predict numbers
within limited attempts. Overall, it’s a simple yet
engaging game that sharpens reasoning skills and
demonstrates basic programming logic effectively.

19/11/2025 NUMBER GUESSING GAME 14

You might also like