• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multi-sided dice  RSS feed

 
D Doemer
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I'm finishing up this assignment, and I'm stuck. These are the last 2 instructions:


5. Roll each of the Dice by invoking the roll method on each Dice in the array.
6. Keep track of the totals sum of all the dice in the array. Be sure to roll the dice array at least 10000 times.

Can someone please tell me how to finish it up?


Thanks so much. Here's my code so far:


 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So which bit of the instructions are you having trouble with? Your code already has a for-loop that loops over the dice array. You just need to do that again, but this time call the appropriate method on each die to roll it.
 
D Doemer
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually need help with both of them. There was a long list of directions and I worked through most of them with my tutor. I found this on a similar assignment, and was wondering if it would work for the first bit of instructions ("invoking the roll method on each dice of the array"):




There's only 2 dice, yes? This is my output:


"run:
Dice with3 sides is showing3
Dice with4 sides is showing2
BUILD SUCCESSFUL (total time: 1 second)"



Thanks!
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look VERY closely at this:


Where exactly does your first for-loop close? I'll give you a hint...it is NOT on line 8.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!