public class Lab8 {
	public static void main(String[] args) {
		int roll1 = 0, roll2 = 0, total = 0;
		int array[] = new int[12];
		for (int i = 0; i < 12; i++)
			array[i] = 0;
		for (int i = 0; i < 36000; i++){
			roll1 = (int)(Math.random() * 6 + 1 );
			roll2 = (int)(Math.random() * 6 + 1 );
			total = roll1 + roll2 - 1;
			array[ total ] += 1;
		}
		System.out.println("Frequency of the sum of two dice rolls: ");
		for (int i = 0; i < 12; i++) {
			if (i < 9)
				System.out.println(" " + (i + 1) + ":  " + array[i]);
			else System.out.println(" " + (i + 1) + ": " + array[i]);
		} // end of For loop
	} // End of Main
} // End of Class


C:\WINDOWS\DESKTOP\Java>java Lab8
Frequency of the sum of two dice rolls:
 1:  0
 2:  1023
 3:  2059
 4:  3016
 5:  3946
 6:  4927
 7:  5817
 8:  5120
 9:  4115
 10: 2979
 11: 2000
 12: 998

C:\WINDOWS\DESKTOP\Java>