Hey guys I need a little bit of help. I am writing a program that generates 100 random numbers and then stores then in an arrays (2, even and odd numbers) I need a little help with passing the array into the function and generating random numbers. What am I doing wrong here. I am getting error saying that the datatype for arraySum is not applicable for sortNumbers. Also am I generating and adding the random numbers correctly? Thanks! Here's me code:
import java.util.*;
public class arraySum {
public static void main( String args[] )
{
int randomNumbers[] = {(int)(100.0 * Math.random()) + 1};
sortNumbers( randomNumbers );
}
public static void sortNumbers( int oddNumbers[], int evenNumbers[] )
{
for (int j = 0; j < randomNumbers.length; j++)
{
if ( randomNumbers[j] % 2 == 0)
{
evenNumbers+=randomNumbers[j];
}
else
{
oddNumbers+=randomNumbers[j];
}
}
}