public class PersonDB{      
  private Person[] people;
  
  public PersonDB(){
    people = new Person[]{new Person("jo",25), new Person("flo",18), new Person("mo", 19)};
  }
   
  /* Calculates and returns the average age. */
  public double getAverageAge(){
    int sum = 0;
    int avg = 0;
    for(int i = 0; i < people.length ; i++){
      sum = sum + people[i].getAge();
    }
    return (sum/(double)people.length);  
  }
  
  /* Returns true if name is in database, otherwise false*/
  // complete, using equalsIgnoreCase() method of String class  
  public boolean isInDatabase(String searchName){
     
    boolean result = false;
    for(int i = 0; i < people.length ; i++){
      if(searchName.equalsIgnoreCase(people[i].getName())){
        result = true;
         break;
      }
     
    }
    return result;  
    
  }
  
}