Information:
The idea behind the program is to fill a randomly generated character array with randomly generated upper and lower case characters. The generated array is of random size between 1 and 10000. Then count how many occurrences of each separate character there is. The program should ask the user if they would like to create another array (i.e. program loop).
The program should output the following:
1. The size of the generated array.
2. The actual array.
3. The total count of each character.
Ok thats it.
I think i am very close with my code but i keeps returning errors with the
b[i] and the "char y[] = new char(size)".when i initialize the "i" it gives me an error on "int= i;" Here's what i have...
package randomarray;
public class randomArray
{
/**
* @param args
*/
public static void fillIntArray(int b[])
{
int = i;
for (int i = 0; i < b.length;i++ );
{
b[i] = (int)(Math.random()* 10000);
}
}
public static void fillcharArray(char b[])
{
int = i;
for (int i = 0; i < b.length;i++ );
{
b[i] = (char)(Math.random()* 10000);
}
if (Math.random() < 0.5);
{
b[i] = (char)((int)(Math.random()*26)+65);
}
}
public static void main(String[] args)
{
int size = (int)(Math.random()*10000);
char y[] = new char(size);
fillCharArray (y);
bubblesort (y);
System.out.println("The size of the array is:"+y.length);
printArray (y);
char c = (char)((int)(Math.random()*26)+65);
{
System.out.println("The random Uppercase is:" +c);
}
char d = (char)((int)(Math.random()*26)+97);
{
System.out.println("The random Lowercase is:" +d);
}
}
}
thanks in advance for the help

New Topic/Question
Reply




MultiQuote





|