Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

While using java what would we need to add in order to find the siblings of a specific person? private void processParents(Scanner input) { while

While using java what would we need to add in order to find the siblings of a specific person?

private void processParents(Scanner input) { while (input.hasNextLine()) { String personName = input.nextLine(); String motherName = input.nextLine(); String fatherName = input.nextLine(); Person p = find(personName); if (!motherName.equals("unknown")) { Person mother = find(motherName); p.setMother(mother); mother.addChild(p); } if (!fatherName.equals("unknown")) { Person father = find(fatherName); p.setFather(father); father.addChild(p); }

import java.util.*;

public class Person { private String name; private Person mother; private Person father; private ArrayList children;

public Person(String name) { this.name = name; this.children = new ArrayList(); }

public String getName() { return this.name; }

public Person getMother() { return this.mother; }

public Person getFather() { return this.father; }

public ArrayList getChildren() { return this.children; public void setMother(Person mother) { this.mother = mother; }

public void setFather(Person father) { this.father = father; }

public void addChild(Person child) { this.children.add(child); } }

// WE NEED TO ADD SOMETHING IN ORDER TO FIND THE SIBLINGS OF A PERSON

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

What are the main objectives of Inventory ?

Answered: 1 week ago

Question

Explain the various inventory management techniques in detail.

Answered: 1 week ago