Please help!! thank you
package com.codegym.task.task08.task0824;
import java.util. ArrayList;
/*
Make a family
*/
public class Solution {
public static void main(String[] args) {
//write your code here
Human child = new Human("child", true, 25);
Human father = new Human("father", true, 48, child);
Human mother = new Human("mother", false, 45, child);
Human gf1 = new Human("gf1", true, 63, father);
Human gm1 = new Human("gm1", false, 60, father);
Human gf2 = new Human("gf2", true, 63, mother);
Human gm2 = new Human("gm2", false, 60, mother);
System.out.println(gf1);
System.out.println(gf2);
System.out.println(gm1);
System.out.println(gm2);
System.out.println(father);
System.out.println(mother);
System.out.println(child);
}
public static class Human {
//write your code here
String name;
boolean sex;
int age;
ArrayList<Human> children = new ArrayList<Human>();
public Human(String name, boolean sex, int age, Human child ){
this.name = name;
this.sex = sex;
this.age = age;
this.children.add(child);
}
public Human(String name, boolean sex, int age){
this.name = name;
this.sex = sex;
this.age = age;
}
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;
}
}
}