0% found this document useful (0 votes)
4 views7 pages

Java Number Guessing Game Project

The document is a project report for a number guessing game developed in Java, where users guess a number between 1 and 100 with a maximum of five attempts. The program provides feedback on whether the guessed number is higher or lower than the actual number and concludes the game if the user exhausts their attempts. The report includes system requirements, coding details, and potential enhancements for the game.

Uploaded by

kaviya.selvame1
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)
4 views7 pages

Java Number Guessing Game Project

The document is a project report for a number guessing game developed in Java, where users guess a number between 1 and 100 with a maximum of five attempts. The program provides feedback on whether the guessed number is higher or lower than the actual number and concludes the game if the user exhausts their attempts. The report includes system requirements, coding details, and potential enhancements for the game.

Uploaded by

kaviya.selvame1
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

CSN43

OBJECTORI
ENTEDPROGRAMMI
NG
WI
THJAVA
MI
NIPROJECT
REPORTON
NUMBERGUESSI
NGGAME

NAME:
KAVI
YA.
S
DEPARTMENT:
COMPUTERENGI
NEERI
NG
ROLLNO:
221081
REGNO:
2113224
SEMESTER:
IV
DATEOFSUBMI
SSI
ON:
12.
04.
2023
ABSTRACT
Thepr oj
ect,weareguessingthenumberwhi chis
greaterandwhichissmal l
erandthenumbershoul dbe
choosebet ween1t o100.I
ftheguessednumberi s
biggerthantheactualnumber,t
heprogram wil
lrespond
withthemessaget hattheguessednumberi shi
gher
thantheactualnumber .
Ift
heguessednumberi ssmal l
er
thantheactualnumber ,
theprogram wi
llr
espondwi t
h
themessaget hattheguessednumberi sl
owert hanthe
actualnumber.I
ftheguessednumberi sequaltothe
actualnumberoriftheKt r
ial
sareexhausted,t
he
program wil
lendwi t
hasui t
abl
emessage.
SYSTEM REQUI
REMENTS
HARDWAREREQUI
REMENTS:
PROCESSOR :i
nit
ial
i33.
iGhz
RAM :4GB
HARDDI
SK :512GB

SOFTWAREREQUI
REMENTS:
OPERATI
NGSYSTEM :
Windows11
LANGUAGE :Jav
a
PROJECTCOADI
NG
i
mpor
tjav
[Link]
il
.Scanner
;

publ
iccl
assGFG{

publ
icst
ati
cvoi
d

guessi
ngNumber
Game(
)

{
Scannersc=newScanner
(Sy
stem.
in)
;

i
ntnumber=1+( i
nt)
(100
*Math.
random(
));

i
ntK=5;

i
nti
,guess;

Syst
[Link].
printl
n(
"Anumberischosen"
+"between1t o100."
+"Guessthenumber "
+"withi
n5trials.
")
;

f
or(
i=0;
i<K;
i++){

Sy
stem.
out
.pr
int
ln(
"Guesst
henumber
:"
);

guess=sc.
next
Int
();

i
f( number==guess)
{[Link]
.pri
ntl
n(
"Congratul
ati
ons!"
+"Youguessedt henumber
.")
;
break;
}
elseif(number>guess&&i!=K–1)
{

Sy
stem.
out
.pr
int
ln(
"Thenumberi
s"+"
great
ert
han"+guess)
;

el
sei
f(number<guess&&i!
=K-1)

Sy
stem.
out
.pr
int
ln(
"Thenumberi
s"+"l
esst
han"+guess)
;

}
}

i
f(i==K)

Sy
stem.
out
.pr
int
ln(
"Youhav
eexhaust
ed"
+"Kt
ri
als.
")
;

Sy
stem.
out
.pr
int
ln(
"Thenumberwas"+number
);

publ
icst
ati
cvoi
dmai
n(St
ri
ngar
g[]

guessi
ngNumber
Game(
);

}
OUTPUT
CONCLUSI
ON
Thisguesst henumbergamei sashortJavaproject
thatall
owst heusertoguessthenumbergeneratedby
thecomput [Link]
earealsosever
alway stoal
terthe
game, l
ikeaddingmor er
oundsordispl
ay i
ngthescore.
I
t ’
squitesi
mpl eandusestherandom functi
onto
generateanumber .

You might also like