please can you take a look to see what Ive done wrong ...many thanks
package com.codegym.task.task08.task0824;
/*
Make a family
*/
import java.util.ArrayList;
public class Solution {
public static void main(String[] args) {
//create
//ArrayList<Human> Nokids = new ArrayList<>();
Human Child1 = new Human("Child1", Boolean.FALSE, 50,new ArrayList<>());
Human Child2 = new Human("Child2", Boolean.FALSE,57,new ArrayList<>());
Human Child3 = new Human("Child3", Boolean.TRUE, 53,new ArrayList<>());
ArrayList<Human> grandkids = new ArrayList<>();
grandkids.add(Child1);
grandkids.add(Child2);
grandkids.add(Child3);
Human Mum = new Human("Mum", Boolean.FALSE,70, grandkids);
Human Dad = new Human("Dad", Boolean.TRUE,80, grandkids);
ArrayList<Human> kids = new ArrayList<>();
kids.add(Mum);
kids.add(Dad);
Human GrandPops1 = new Human("GrandPops1", Boolean.TRUE, 100, kids);
Human GrandPops2 = new Human("GrandPops2", Boolean.TRUE, 100, kids);
Human GrandNan1 = new Human("GrandNan1", Boolean.FALSE, 110, kids);
Human GrandNan2 = new Human("GrandNan2", Boolean.FALSE, 110, kids);
System.out.println(GrandNan1.toString());
System.out.println(GrandPops1.toString());
System.out.println(GrandNan2.toString());
System.out.println(GrandPops2.toString());
System.out.println(Mum.toString());
System.out.println(Dad.toString());
System.out.println(Child1.toString());
System.out.println(Child2.toString());
System.out.println(Child3.toString());
}
public static class Human {
//instance fields
String name;
boolean sex;
int age;
ArrayList<Human> children;
//constructor
Human (String Name, Boolean Sex, int Age, ArrayList<Human> Children) {
this.name=Name;
this.sex=Sex;
this.age=Age;
this.children=Children;
}
//methods
public String toString() {
String text = "";
text += "Name: " + this.name;
text += ", sex: " + (this.sex ? "male" : "female");
text += ", age: " + this.age;
int childCount = this.children.size();
if (childCount > 0) {
text += ", children: " + this.children.get(0).name;
for (int i = 1; i < childCount; i++) {
Human child = this.children.get(i);
text += ", " + child.name;
}
}
return text;
}
}
}