help with a simple java problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

help with a simple java problem

ApplellialApplellial Posts: 21Member
Hello, so, as the title says, I could use some help with a simple problem I've run into when trying to code a little game, to try and refresh my java skills (which clearly are lacking severely >.< ).

So, I made a game and I want to have the players take turns. I've decided to try and challenge myself and make the turns be decided on who can guess nearest to a random number from 0-100.

I have the random number generator and the user inputs, but I'm running into trouble figuring out how to find out who got nearest to the generated number.

I have the two variables, p1_guess and p2_guess, right now and the random number generator.

If anyone can offer any help or advice on this it would be most appreciated, and don't worry, it's not a homework assignment; I'm a sad person and do this for "fun"... XD

Thank you,


Sign In or Register to comment.