Hello,
My assignment is to write code simulating dice, generating 10000random numbers between 1-6. Then I have to display the number of 1's that appeared, the number of 2's that appeared, etc in a joptionpane like this:
The number of 1s appeared is
The number of 2s appeared is
The number of 3s appeared is
The number of 4s appeared is
The number of 5s appeared is
The number of 6s appeared is
This is my code so far:
public class ARG { public static void main(String[] args) { int[] A = new int[10000]; for(int i=0; i<A.length; i++) A[i] = 1 + (int) (6*Math.random()); } { for(int i=0; i<A.length; i++) System.out.println(A[i]); for(int i = 0; i < 6; i++) System.out.println("Total number of " + (i+1) + " = " + A[i]); } }
The variable errors I keep getting are:
F:\ARG.java:13: error: cannot find symbol
for(int i=0; i<A.length; i++)
^
symbol: variable A
location: class ARG
F:\ARG.java:14: error: cannot find symbol
System.out.println(A[i]);
^
symbol: variable A
location: class ARG
F:\ARG.java:18: error: cannot find symbol
System.out.println("Total number of " + (i+1) + " = " + A[i]);
^
symbol: variable A
location: class ARG
3 errors
Tool completed with exit code 1
I'm a beginner so please if you can help me in any way, it would be appreciated.