Question: Given these methods below how would we make a new method to get it to list the siblings of a person? public static void showPaternal(Person

Given these methods below how would we make a new method to get it to list the siblings of a person?

public static void showPaternal(Person person) { System.out.println("Paternal line:"); int level = 1; while (person!= null) { for (int i = 0; i < level; i++) System.out.print(" "); System.out.println(person.getName()); person= person.getFather(); level++; } }

public static void showMaternal(Person person) { System.out.println(" Maternal line:"); int level = 1; while (person!= null) { for (int i = 0; i < level; i++) System.out.print(" "); System.out.println(person.getName()); person= person.getMother(); level++; } }

public static void showChildren(Person person) { ArrayList kids = person.getChildren(); System.out.println("Children:"); if (kids.size() == 0) { System.out.println(" none"); } else { for (Person kid: kids) { System.out.println(" " + kid.getName()); } } }

//MAKE METHOD TO GET SIBLINGS

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!