21.4k views
0 votes
I need help with this I am so confused on where to start can someone help me?

I need help with this I am so confused on where to start can someone help me?-example-1
User Dlcardozo
by
5.4k points

1 Answer

2 votes

Just iterate over the Pokemon array and check how many times the pokemon countMe exist:

public int countThemAll(Pokemon[] pokedex, Pokemon countMe) {

int count = 0;

for (int i = 0; i < pokedex.length; i++) {

if (pokedex[i].equals(countMe)) {

count++;

}

}

return count;

}

User Andy Jazz
by
5.9k points