Creates an array of integers of size 100 and fills the array with random integers from 0 through 9
Creates a second integer array of size 10 and counts the occurrences of values in the first array into the corresponding position in the second array (and print out neatly to verify).
Finds the least frequent value in the large array (and print out) by finding the smallest value in the second array (with a sequential search).
Displays (print out neatly) the locations (indices) in the large array of the least frequent value by finding the result from step three in the large array.
basically i'm trying to get random numbers 0-9 then print in rows/columns
so i can read them easily with spacing of course at the end i want it to count up the numbers print least so 7 was least at 15, 38, 92, 98
i'm not really sure about this anyway. any help would be very appreciated.
code
Code
public class Program7
{
public static void main(String[] args)
{
creatRandom();
int[] randomArray = new int [100];
for (randomArray [i] = (int) (math.random() * 10);
printrandom();
for ( int i = 0; i < randomArray.length; i++)
{
if (i+1 % 10 == 0)
println(randomArray [i]);
else
print(randomArray[i]);
}
print int [] counts = new int [10];
//0-99
for (big array loop);
counts[randomArray [i]] ++;
//row and col 0-9
for (row = 0);
(col = 0);
Array[row * 10 + col];
}
}
errors as of now
Code
Program7.java:20: error: illegal start of expression
for ( int i = 0; i < randomArray.length; i++)
^
Program7.java:20: error: ')' expected
for ( int i = 0; i < randomArray.length; i++)
^
Program7.java:20: error: > expected
for ( int i = 0; i < randomArray.length; i++)
^
Program7.java:20: error: not a statement
for ( int i = 0; i < randomArray.length; i++)
^
Program7.java:20: error: ';' expected
for ( int i = 0; i < randomArray.length; i++)
^
Program7.java:28: error: not a statement
print int [] counts = new int [10];
^
Program7.java:28: error: ';' expected
print int [] counts = new int [10];
^
Program7.java:31: error: ';' expected
for (big array loop);
^
Program7.java:31: error: ';' expected
for (big array loop);
^
Program7.java:37: error: ';' expected
for (row = 0);
^
Program7.java:38: error: not a statement
(col = 0);
^
Program7.java:38: error: ')' expected
(col = 0);
^
Program7.java:40: error: not a statement
Array[row * 10 + col];
^
13 errors