Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

usingjava and binary tree to help to defining and querying general family trees. You should apply animplementation of the ADT Tree. we are given two

usingjava and binary tree to help to defining and querying general family trees. You should apply animplementation of the ADT Tree.

we are given two input text files, making 2 trees ,1 for male and 1 for female.

The first input file lists the names and genders of different persons. We will assume that a name is a single string consisting only of letters with no empty spaces. The gender can be M for male and F for female.

[ An example of the first input file is as follows:

John, M

Mike, M

Alisa, F

Alina, F

... ]

We will also assume that every person name isunique.

The second input file lists parent-child relationships. [An example is as follows:

John, Mike

Alisa, Mike

... ]

Here, the first line indicates that John is a parent of Mike whereas the second line indicates that Alisa is the second part of Mike. Clearly, John is the father of Mike and Alisa is the mother of Mike.

You will develop a program that reads the two input files, and then provides users with functions to query the family tree.

After reading the input files, the program should ask the user to choose one of the following options:

1- who is the father of?

2- who are the siblings of?

3- Who are the sons of?

4- Who are the uncles of?

5- Who are the aunts of?

--------------------------------------------------------------------------------

The user enters an option, then the program should ask the user to enter the person's name. Then, the program displays the answer if the person exists, or an error message in case the person does not exit. In some cases, the result can be empty. In these cases, the program simply prints an empty line. The program should keep asking the user (e.g., using a loop) until the user enters a number outside the range (1-5).

-----------------------------------------------------------------------------------------------------------------------

should submit the following items:

  1. All files in the Java program.
  2. The input files used for testing the program.
  3. A screenshot of the output of the program when entering several queries.
  4. A sketch of the family tree which should help the instructor to know the family tree used as input.
  5. A time efficiency analysis for the worst, average, and best cases using Big-O notation for a method that implements one of the five search options.

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

Students also viewed these Programming questions