42 std::cout <<
"- Child: Age=" <<
age <<
" School=" <<
school << std::endl;
47 if (school ==
nullptr) {
59 double minDist = std::numeric_limits<double>::infinity();
61 if (schools->size() == 0) {
64 std::list<AGSchool>::iterator it;
66 for (it = schools->begin(); it != schools->end(); ++it) {
67 if (it->acceptThisAge(
age) && it->getPlaces() > 0 && housePos.
distanceTo(it->getPosition()) < minDist) {
68 minDist = housePos.
distanceTo(it->getPosition());
87 return (
school !=
nullptr);
A location in the 2D plane freely positioned on a street.
double distanceTo(const AGPosition &otherPos) const
Computes the distance between two AGPosition objects.
bool setSchool(AGSchool *school)
AGPosition getSchoolLocation() const
bool allocateASchool(std::list< AGSchool > *schools, AGPosition housePos)
void print() const
Puts out a summary of the class properties.
int getSchoolOpening() const
int getSchoolClosing() const