AP Computer Science Dice Probability Help

For AP Computer Science Online we had a very noneducational lesson on nested loops, then we had a very difficult program to write afterwards here it is:

Write a program to simulate tossing a pair of 11-sided dice and determine the percentage of times each possible combination of the dice is rolled.

3. Ask the user to input how many times the dice will be rolled.
4. Calculate the probability of each combination of dice. (You may want to start with
more familiar six-sided dice.)
5. Print the results neatly in two columns (do not worry about excessive decimal places).
6. What is the effect on the percentages when the number of rolls is increased?
7. After the program works, you might want to make it more interesting and ask the user
to enter the number of sides on a die (singular for dice).

We need to use nested loops not a long if, else if, else statement. Here is my source code so far. It is complete and formatted correctly but the problem is that my probability comes up as 0.0. I believe it has to do with the totalMatches variable. Can someone please help me?

Please edit your post and wrap the code in code tags to make it easier to read and understand.

Are you having problems with integer math? 4/6 = 0
4.0/6 = 0.66666

Thank you for telling me about the code tags, first time on a forum asking for help . Well about the integer math, that doesn't seem to be the problem, as i made sure everything was casted, properly for the probability variable. Also that shouldn't really be an issue. But thank you for the quick response!

Thank you for telling me about the code tags, first time on a forum asking for help . Well about the integer math, that doesn't seem to be the problem, as i made sure everything was casted, properly for the probability variable. Also that shouldn't really be an issue. But thank you for the quick response!

I looked back at the code and gave it a try. I made the variables totalMatches, and totalRolls doubles and fixed it! Thank You Very Much !

Sorry for such a quick reply earlier, I was upset at something and didn't quite see the logic in your statement.

Print out the intermediate results to see if the code is working before computing the final value.

Look at this again: 4/6 = 0

Are all the results 0? If so, then you are probably doing integer math.

I did do that before but the strange thing was it gave me actual values. What I failed to realize was that I tried to convert two divided integers to a double at the end of the program, which either resulted in a divide by zero error, or 0.0 .