OK. I need help with my homework. I a few problems to complete I was able to get pass the first few but I'm stuck. They are progresive problems So If I can get this one going I think I will be OK with the rest.
This is what I have to do.
Create a method called countOdds which takes an integer array as a parameter, and returns the number of odd entries in the array.
This the code we where given and an example of it.
Examples:
theArray:{10, 3, 6, 3, 8, 10} ==> 2
theArray:{11, 3, 6, 7, 9, 60} ==> 4
public int countOdds(int[] data){}
THis is what I have so Far.
int i;
countOdds[] odds = new countOdds[5];
for(i = 0; i < odds.length - 1; i++)
if countOdds[]%2 = 0;
Im so lost right now. I know I need to use Mod to determine if it is Odd or notbut I not sure how to put this in my code. Any help would be greatful or a guide in the right direction. Thanks