I'm writing a program that generates 100 random integers from 0 to 25 and stores them in an array. Then, the program should call class methods to sort the odd numbers into an array and the even numbers into another array. This is what I have so far...
public class U8 { public static void main( String [] args ) { final int numOfIntegers = 100; int[] even = new int [numOfIntegers]; int[] odd = new int [numOfIntegers]; int randomNum; int i = 0; int j = 0; for( int count = 0 ; count < numOfIntegers ; count++ ) { displayEvens(new int[]{Math.random() * 25 + 2}); displayOdds(new int[]{Math.random() * 25 + 2}); } public static void displayOdds( int randomNum ) { for( count = 0 ; count < i ; count++ ) { if(randomNum / 2 == 1) { i++; displayOdds( randomNum ); } System.out.print( even[count] ); System.out.println( "Odd Numbers: " ); System.out.print( odd[count] ); } } System.out.println(); public static void displayEvens( int randomNum ) { for( count = 0 ; count < j ; count++ ) { if(randomNum / 2 == 0) { j++; displayEvens( randomNum ); } System.out.print( even[count] ); } } } }
When I try to complie it, it keeps telling me ';' expected at public static void displayOdds..... etc and display Evens....
also, '.class' expected at (int randomnum)
and, 'illegal start of expression' at public static void displayOdds/Evens...
What am I typing wrong???
Thank you all in advance1