Stephan van Hulst wrote:It doesn't say in the requirements you need a nested loop.
Stephan van Hulst wrote:I apologize, I didn't notice you already had a variable with that name. I meant a new variable, which you have interpreted correctly.
Anyway, looking at your program, I don't see why it would keep asking for input. You should have an entirely different problem on your hand, namely that you're stuck in a permanent loop. Have a look at the exit condition of your nested for loop.
By the way, you can also eliminate a lot in your display code.
If I may give you a big hint, I think you are using the nested loop for the wrong purpose. Tell me, how many dice do you have?
Stephan van Hulst wrote:First of all, start by making your program more clear by eliminating all the 'cases' you use. You can store your values in a simple array like this:
rolls[random -1]++;
This will *greatly* decrease the verbosity of your program, and make it more clear why it's doing what it does.
Paul Beckett wrote:Make sense now?
fred rosenberger wrote:
I corrected your code tags to get it to display better.
[edit]apparently there was a minor bug in our release that cause the code tags to not work correctly.[\edit]
The first tip i have is to ask you to explain what "it runs but, but not correctly" means. What do you expect it to do, and what does it do? Why is that not what you expect? We have no way to know how to 'fix' the code to get it to do what you expect if we don't know what that is.
The easier you make it for someone to help you, the more likely you are to get that help.
Paul Beckett wrote: think about your conditional logic. Hint: You have four conditions, the first two are "equal" and "not equal".
Sean Clark wrote: Oops, I see why you have used it, please ignore me.
Lester Burnham wrote: You're using the "==" operator to compare strings - BIG no-no! You need to use the "equals" method instead.
Campbell Ritchie wrote:It was your heart rate thing I executed, not the random thing.
Have you read the documentation for the nextInt method? I think you have completely misunderstood what the (int) bit means.