Actually I didn't get the question, please someone explain it in detail
Can anyone please explain what the conitions are saying.
Resolved
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Denise
8 August 2019, 14:23solution
The first condition is to add 4 variables/fields (String name, boolean sex, int age, and ArrayList<Human> children) to the Human class.
The second condition is to create new Humans in the main method. And you should do this in such a way, that there are two grandfathers, two grandmothers, one father, one mother, and three children, so 9 new Human objects in total.
So for instance, you have 3 new Humans: childA, childB and childC.
Then you create their parents: Human father, with all three children in his children ArrayList, and Human mother, who has also an ArrayList filled with the three children.
For the grandparents, you have a Human grandMotherA and a Human grandFatherA, that both have the Human father in their children ArrayList. And Human grandMotherB and grandFatherB have the mother as their child.
And the third condition is to print all those Humans using the toString() method.
Hope this helps a bit. :-)
+3