I'm working with aggregation and inheritance and I can't seem to figure out how to have separate arrays for separate objects. With this example, how would I make it so each club has it's own array of people so that I can print out a list of clubs and the members which belong to each.
public class Application{
public static Club[] clubArray = new Club[10];
//prompt user for club name
clubArray[x++] = new Club(name);
//prompt user for person name
Person newPerson = new Person(name);
clubArray[x-1].addPerson(newPerson);
personCount++;
}
public class Club{
public Person[] personArray = new Person[100];
//addPerson method
public void addPerson(Person newPerson){
personArray[x] = newPerson;
}
}
}