CS 245 - Assignment 3 Fall, 2022
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
CS 245 - Assignment 3
Fall, 2022
Assignment 3 - So Many Roosevelts!
The goal of this assignment is to demonstrate your mastery of object oriented design and advanced collection data structures by handling complex relationships efficiently and compactly.
Background
In this assignment, you will accept information about and display a family tree. As an example, we can use the famous AmericanRoosevelt family, which includes several political figures, inventors and socialites. Among the members of this family are Anna Eleanor Roosevelt (mostly known without her first name, i.e. as “Eleanor Roosevelt”) and her husband Franklin Delano Roosevelt who are distant cousins — specifically: fifth cousins, once removed. (See “How Are WeRelated” for an explanation of what this means.) The implication of this is: while we are accustomed to discussing family trees, the relationships here are too complex to model with an n-ary tree..
Functional Requirements
Accept personal information
Your implementation is required to accept information about individuals via a function or command-line interface. Each person has a name, a year of birth, an optional year of death, zero, one or more marriages and zero, one or more other noteworthy events. We may consider the person information of Anna Eleanor Roosevelt as the following:
● Name = Anna Eleanor Roosevelt
● Year of birth = 1884
● Year of death = 1962
Accept relationship information
Your implementation is required to accept information about how individuals are related to each other. There are only two acceptable relationships: parents and children or spouses (i.e. marriages). Two people cannot be related in multiple ways — i.e. children are not allowed to marry their parents. A person may have multiple children and multiple spouses.
Accept event information
Your implementation is required to accept information about noteworthy event information. Each event has a start year and a post or other description. An individual may have multiple events. While events may not be entered in any particular order, they must be displayed in chronological order by year.
Display the family tree for one person
Your implementation must display the family tree for one person. The partial (incomplete) tree for Eleanor
Roosevelt is as follows:
Anna Eleanor Roosevelt (1884-1962); 1946: 1st Chair of the United Nations Commission on Human Rights; 1947: 1st United States Representative to the United Nations Commission on Human Rights; 1961: 1st Chair of the Presidential Commission on the Status of Women m. Franklin Delano Roosevelt Franklin Delano Roosevelt Jr. (1914-1988); 1949: Member of the U.S. House of Representatives from New York's 20th district; 1963: United States Under Secretary of Commerce Franklin Delano Roosevelt III (1938-) Anna Eleanor Roosevelt Halsted (1906-) Anna Eleanor Roosevelt Dall (1927-) Curtis Roosevelt Dall (1930-) John Roosevelt Boettiger (1939-) Elliott Roosevelt (1910-) James Roosevelt II (1907-) Sara Delano Roosevelt (1932-) James Roosevelt III (1945-) James Roosevelt II (1907-) Sara Delano Roosevelt (1932-) James Roosevelt III (1945-) John Aspinwall Roosevelt II (1916-) |
Display 1: An example of the Too Many Roosevelts implementation
Specifically: each person has a name, year of birth and death (if available) and any number of events (in chronological order) and marriages (in any order). Each new generation (child, grandchild, etc.) should appear indented from the person as is shown for “Franklin Delano Roosevelt Jr.” and “Franklin Delano Roosevelt III” .
Recreate and print a family tree
Given these requirements, prove that your implementation is able to recreate the family tree descending from one individual like the one for Eleanor Roosevelt in Display 1 above. Feel free to use a different family if you prefer, but you must show:
● At least three generations of a family starting with indentation as shown above
● At least one marriage
● Events for at least one person added in non-chronological order but displayed in chronological order
While your implementation may be different, you may recreate this tree with a series of function calls like:
FamilyTree tree = new FamilyTree();
// Details for Eleanor Roosevelt
tree.addPerson("Anna Eleanor Roosevelt",
tree.addEvent("Anna Eleanor Roosevelt", Commission on the Status of Women");
tree.addEvent("Anna Eleanor Roosevelt",
1884, 1962); // DOB, death 1961,"1st Chair of the Presidential
1947,"1st United States
Representative to the United Nations Commission on Human Rights");
tree.addEvent("Anna Eleanor Roosevelt", 1946,"1st Chair of the United Nations
Commission on Human Rights");
// Details & marriage for Franklin Delano Roosevelt
tree.addPerson("Franklin Delano Roosevelt", 1882, 1945); // DOB, death
tree.addRelationship("Franklin Delano Roosevelt", "Anna Eleanor Roosevelt", "married");
// Details & parents for Franklin Delano Roosevelt Jr.
tree.addPerson("Franklin Delano Roosevelt Jr.", 1914);
tree.addRelationship("Anna Eleanor Roosevelt", "Franklin Delano Roosevelt Jr.", "parent");
Once compiled, your implementation must be callable from a command line with no arguments, as follows:
java A3
Non-Functional Requirements
There are three non-functional requirements.
Your implementation is expected to be efficient with respect to space and time. Specifically: whether your implementation compactly represent each person and their relationships
Your implementation is expected to exhibit good Object-Oriented Design, specifically:
● The Java class(es) used in the implementation must represent a reasonable encapsulation of data andseparation of concerns
● The methods for each class must constitute a reasonable set of (reusable) functions
Your implementation is expected to exhibit a consistent and readable style, specifically:
● The functions, variables, etc. must display a reasonable and consistent naming convention
● The indentation must be consistent
● The comments for functions should follow a Javadoc style, and within functions, complex code should be consistently commented
Submission
Check your Java code — including any main function, interfaces and classes — into a GitHub repository. Add any comments in the README.md file in the same repository as your source code. Submit the link to this GitHub repository on Canvas.
Grading
Your grade for this assignment will be determined as follows:
● 55% = Implementation: your class implementations must run successfully with the source files and data provided. It must produce the expected results, a sample of which appears in the Implementation section above. Any deviation from the expected results results in 0 credit for implementation.
● 20% = Decomposition: in the eyes of the grader, your solution follows the suggestions above or otherwise must represent a reasonable object-oriented and procedural decomposition to this problem.
● 15% = Efficiency: your code must consistently use the most efficient data structures for the task and must consistently use the most efficient algorithms on those data structures.
● 10% = Style: your code must be readable to the point of being self-documenting; in other words, it must have consistent comments describing the purpose of each class and the purpose of each function within a class. Names for variables and functions must be descriptive, and any code which is not straightforward or is in any way difficult to understand must be described with comments.
Late assignments will not be accepted.
2022-12-05