I'm trying to create a method called averageCustomerAge() which should return an int representing the average age of all Customer objects in the store. The issue is I'm running into an error that says I'm missing a return statement, but when I attempt to add one, I get another error saying "cannot find symbol." Anyone know how to work around this?
public int averageCustomerAge() {
for (int i = 0; i < customerCount; i++) {
int sum = 0;
sum += customers[i].age;
int average = (sum / customerCount);
}
return average;
}
}