
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. Display the results in a tabular format and determine if your results are reasonable.I am trying to get the application to tally the actual combination's of rolls possible within the array. I need 2 arrays.
Help plese!