Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tudor Kings and Queens of England You are to write a program that uses recursion to find all family ancestors and descendants of a given

Tudor Kings and Queens of England
You are to write a program that uses recursion to find all family ancestors and descendants of a given person.
The program asks for the name of the family data file and then prompts for a specific persons name. If the person is in the family database, the program shows all the ancestors and all the descendants for that person. For ancestors it must show all parents, all grandparents, all great grandparents, etc. For descendants it must show all children, all grandchildren, all great grandchildren, etc. The program also must use indentation to make it clear who is a parent of whom and who is a child of whom. As a test data file, you will be using information about the Tudor kings and queens of England. The name of the file is tudor.txt.
Format of tudor.txt: The first section of the file (until the line with END has all the unique family members. The section of the tudor.txt after the "END" is divided
into groups of three - first the family member, then his/her mother, then his/her father. This is how you can tell who is related to whom.
i.e.:
Arthur > Family Member Elizabeth of York -> Mother Henry VII -> Father
Henry VIII > Family Member Elizabeth of York -> Mother Henry VII -> Father
etc.
Special cases: The data file contains no information prior to Henry VII, so when you ask for information about him, you get a lot of descendants but no ancestor information. Below is the log of execution you should obtain for him.
What is the input file? tudor.txt Person's name ('quit' to end)? Henry VII
Ancestors:
Henry VII
Descendants:
Henry VII
Arthur
Henry VIII
Mary I
Elizabeth I
Edward VI
Margaret
James V
Mary, Queen of Scots
James VI & I
Margaret Stuart
Henry, Lord Darnley
Mary Frances
James VI & I
Lady Jane Grey
At the other extreme is James VI of Scotland who became James I of England. The data file has no information about his descendants, but a great deal of information about his ancestors. Below is the log you should obtain for him.
What is the input file? tudor.txt
Person's name ('quit' to end)? James VI & I Ancestors:
James VI & I
Mary, Queen of Scots
Mary of Guise
James V
Margaret
Elizabeth of York
Henry VII
James IV
Henry, Lord Darnley
Margaret Stuart
Margaret
Elizabeth of York
Henry VII
Descendants:
James VI & I
Your task: You are required to demonstrate that your program works for these two individuals and for another in the middle of this family tree. In particular, you should test it for Margaret. Below is the log you should obtain for her.
What is the input file? tudor.txt Person's name ('quit' to end)? Margaret Ancestors:
Margaret
Elizabeth of York
Henry VII
Descendants:
Margaret
James V
Mary, Queen of Scots
James VI & I
Margaret Stuart
Henry, Lord Darnley
James VI & I
Your client program should be named Relatives.java and it should include only static methods. It should prompt the use for the test file and then for the name of the person. If the name does not exist it should print a message and quit. If the name exists it should print the ancestors and descendants as shown in the above examples.

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions