Javaminiproject
Javaminiproject
Submitted to
University of Mumbai
Supervisor
Prof. Shahegul Afroz
This Java program implements a simple Number Guessing Game, where the
player tries to guess a randomly generated number between 1 and 100.
Key Features:
2. User Input Handling: It takes user input via the Scanner class to allow
the player to input guesses.
5. Loop Until Correct Guess: A while loop ensures the game continues
until the player guesses the correct number, keeping the game
interactive.
Packages ::
In the provided Java program, two package is used:
1. java.util.Random:
This package provides the Random class, which is used to generate
random numbers.
In this program, Random rand = new Random(); generates a random
number between 1 and 100 using rand.nextInt(100) + 1.
2. java.util.Scanner:
This package provides the Scanner class, which is used to read user input.
In the program, Scanner scanner = new Scanner(System.in); is used to
capture the player's guess from the console input.
Both of these classes are part of the java.util package, which contains
utility classes for handling data structures, random number generation,
and input handling in Java.
ScreenShots ::
The program starts by welcoming the user and prompting them to Guess one
number between 1 to 100.
In this screenshot,
User has guessed the first no as 76 which is too low and second number
as 95 which is too high.
In this screenshot,
After some random guesses user has entered the correct number ,