I need to create a class of a country. one of it's attributes is an array of cities. I am required to write a method that can find the city's extension in the array when it's name is given (a name of a city is one of its attributes, and it can be reached by using the getCityName() method).
I wrote this code:
private int findCityExtensionByName (String cityName)
{
for(int i=0 ; i<=MAXIMUM_NUMBER_OF_CITIES ;i++)
{
if (_cities[i].getCityName().equals(cityName))
return i;
}
}
but I get this compliation error: "Missing return statement". I'm clueless in regards of how to fix this.
I'm sorry if this is unclear since this is my first time using this site.