0
/ 30
Roxy has written a method to count the number of people in her neighborhood, excluding children under 16 and individuals who are only...
Roxy has written a method to count the number of people in her neighborhood, excluding children under 16 and individuals who are only renting their homes. However, her method seems to be giving her incorrect results! On which line of code is the issue?
public int headCount(Person[] neighbors) {
int count = 0;
for (Person x : neighbors) { // Line 3
if (x.getAge() > 16) { // Line 4
continue;
} else if (x.isRenting()) { // Line 6
continue;
} else {
count++; // Line 9
}
}
return count;
}
Your feedback will appear here when you check your answer.