Design a java program that generates 100 random numbers, and keeps a count of how many of those random numbers are even and how many are odd.
This is what I have and it is not suppose to be an array just simple coding with a boolean.
import java.util.Random;
public class RandomNumbers
{
public static void main(String[] args)
{
// Create a Random object
Random randomNumbers = new Random();
//Declare Variables
int count;
int number;
int odd;
int even;
//Loop displays 100 random numbers
for (count = 0; count <= 100; count++)
{
number = randomNumbers.nextInt()+1;
System.out.println(number);
if((number % 2) == 0) // remainder function
int even;
else
int odd;
return even;
}
System.out.println("This is the amount of even:"+even);
System.out.println("This is the amount of odd:"+odd);
}
}
}