2 Replies - 451 Views - Last Post: 18 November 2012 - 08:05 PM Rate Topic: -----

#1 headwrecked  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-November 12

Need help with Java Dice Game

Posted 18 November 2012 - 03:41 PM

Hi,
I'm completely new to Java and by god is my head wrecked with it.

I'm trying to write a program that does the following.

Generates x number of random tosses

Asks the user to guess each die toss

Validates user input is Int between 1 & 6

Count how many correct guesses were made

If incorrect say guess was incorrect and let me know what die toss was

Display total num of correct tosses

I don't even know where to begin. I can manage to generate random number for two dices and get the user to enter a number. That's as far as I can get.

Can anyone even point me in the right direction as to what areas i should be researching.

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Need help with Java Dice Game

#2 GregBrannon  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2203
  • View blog
  • Posts: 5,235
  • Joined: 10-September 10

Re: Need help with Java Dice Game

Posted 18 November 2012 - 03:54 PM

It sounds like you have a pretty good start. Once you have a random number and a user guess, compare the two with an if statement or a number of if/else statements and provide the correct response. When you're ready, post the code you have so far and let us know what you need help with.
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: Need help with Java Dice Game

Posted 18 November 2012 - 08:05 PM

View Postheadwrecked, on 18 November 2012 - 06:41 PM, said:

I don't even know where to begin. I can manage to generate random number for two dices and get the user to enter a number. That's as far as I can get.

Random ran = new Random();
int n = ran.nextInt(11) + 2;
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1