
Ok here is my code-
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Random;
/**
*
*/
public class ContinueRollDie {
* @param args the command line arguments
*/
public static void main(String[] args) {
Random randomNumber = new Random();
int[][] frequency = new int[9][9];
int die1 = 0;
int die2 = 0;
for (int roll = 1; roll <= 64000; roll++) {
die1 = randomNumber.nextInt(8) + 1;
die2 = randomNumber.nextInt(8) + 1;
frequency[die1] [die2]++;
}
System.out.printf("%s%16s\n", " Sum", " Frequency");
for (int sum = 2; sum <= 12; sum++) {
System.out.printf("%4d%16d\n", sum, frequency[die1][die2]);
}
}
}
This is what I am trying to get my program to due- using a two-dimensional array to tally the actual combinations of rolls. A roll of 2 and 7 would be different than a roll of 7 and 2. The application should roll the dice 64,000 times.
I are trying to get the application to to tally the actual combination's of rolls possible within the array
Help plese!

Hi Friend,
Try the following code:
import java.util.Random;
public class ContinueRollDie{
public static void main(String[] args){
Random randomNumber = new Random();
int die1;
int die2;
int frequency[] = new int[ 13 ];
for ( int index = 0; index < frequency.length; index++ )
frequency[ index ] = 0;
for ( int roll = 1; roll <= 64000; roll++ ) {
die1 = 1 + randomNumber.nextInt( 6 );
die2 = 1 + randomNumber.nextInt( 6 );
frequency[ die1 + die2 ]++;
}
System.out.printf( "%3s%12s\n","Sum", "Frequency" );
for ( int i = 2; i < frequency.length; i++ ) {
System.out.printf( "%3d%12d\n", i, frequency[ i ]);
}
}
}
Hope that it will be helpful for you.
Thanks

Thanks for your help but what I need is a two-dimensional array to tally the actual combination's of rolls 2 d array, not 1, thank you so much!
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.