100% found this document useful (1 vote)
2K views

Number Guessing Game Using Java: Mini Project On

This document describes a number guessing game created in Java. The objective is to have the user guess a randomly generated number within a set range in the fewest number of attempts. It provides the rules, algorithm, and graphical user interface components used. The game demonstrates concepts like user input, conditional checking, loops, and random number generation. It is intended to help players improve problem solving skills and exercise their brain.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
2K views

Number Guessing Game Using Java: Mini Project On

This document describes a number guessing game created in Java. The objective is to have the user guess a randomly generated number within a set range in the fewest number of attempts. It provides the rules, algorithm, and graphical user interface components used. The game demonstrates concepts like user input, conditional checking, loops, and random number generation. It is intended to help players improve problem solving skills and exercise their brain.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

MINI PROJECT ON

NUMBER GUESSING GAME USING


JAVA
Department Of Electronics And Communication Engineering

Prepared By : GUIDED BY

Anand C V Santhosh Kumar


• 4GM18EC009
• ASSISTANT PROFESSOR CSE,GMIT
Darshan G
• 4GM18EC030

Nagaraju T V
• 4GM18EC055
CONTENTS
 Introduction………………………………………………………………………………………….1
 Objective…………………………………………………………………………………………….2
 Problem statement................................................................................................................3
 Rules of the Number Guessing Game………………………………………………………….4
 Algorithm for Number guessing game…………………………………………………...........5
 GUI…………………………………………………………………………………………………….6
 Advantages…………………………………………………………………………………………7
 Conclusion…………………………………………………………………………………………..8
INTRODUCTION
 In This Program We Are Supposed To Make A Simple Guessing Game Where The User Guess
The Number Selected By The Computer And Goal Is To Introduce The Power And Usage Of
Random As Well As The How To Benefit Current Time Mill Is() Method Of The System Class
In Order To Check How Much It Took The Player Guessing The Number
OBJECTIVE
 The aim of the game is to find the secret number in minimum number of guesses.
 Guess the number game is used to illustrate basic principles of programming. It demonstrates
use of user input, conditional checking and loop constructs.
 It also demonstrates use of random number generation.
 If user guess number and computer guess number matches then game terminate.
PROBLEM STATEMENT
 It is worth having idea and knowledge how the guessing game works before jumping to the
code.
 When player run the program he can set the number range whatever he likes. Then the user
guess the number. If user guess number computer guess number matches the it will print the
statement “congratulation you have won” if not it will print the statement “sorry, you have
lost. Try again”.
RULES OF THE NUMBER GUESSING GAME
 The computer randomly select the computer guess number within the defend range of number and
promote the player to guess the number.
 In this program, the player enters any random number within the defined range. We call it as input
Number.
 Then the computer randomly generate computer guess number within the defend range.
 If the player number i.e input Number is same as the computer guess number then the game stops.
 The game continues till the player guesses the correct number.
ALGORITHEM FOR NUMBER GUESSING GAME
 Step 1: Create three variables attempt, user guess number, computer guess number and initialize
them.
 Step 2: Take a input from user and generate the random number
 Step 3: Start a loop and Generate a random number.
 Step 4: Validate user input and match with the computer guess number.
 Step 5: if user guess number and computer guess number are matches, exist the game.
 Step 6:Repeat from Step 3.
GUI (GRAPHICAL USER INTERFACE)
 A GUI is a system of interactive visual components for computer software.
 It is a user interface that includes graphical elements, such as windows, icons and buttons.
 A GUI uses a combination of technologies and devices to provide a platform that users can
interact with, for the tasks of gathering and producing information.
 The game will be played using the following GUI components
 A JLabel should display a message similar to, “I’m thinking of a number between 1 and 1000.
Guess it!” A JTextField should be used to input the guess
Code explanation
ADVANTAGES
 Enlarging knowledge
 Enriching vocabulary
 problem solving
 Guessing games help kids to think about numbers, their approximations and various
combinations
 A proper workout to the brain can be ensured through guessing games
CONCLUSION
 We have used random class in this application to generate random numbers of integers in a specific
range.
 Random class has many other useful methods where gives the power to generate random floating
point numbers etc.
 Using random concept inside the program has much usages in many applications programs and
area for instance lottery applications, random advertisement, random security images, random
questions with random options ,etc
Thank you

You might also like