Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Person class This class implements the Comparable interface ( details below ) . This class has instance variables and accessor methods for Date born, Date
Person class
This class implements the Comparable interface details below
This class has instance variables and accessor methods for Date born, Date died, and Name name. It has the following methods:
public Person Date born, Name name: This constructor throws IllegalPersonException exceptions if either born or name is null.
public void dieDate dateOfDeath: this method sets the died instance variable to the dateOfDeath provided.
public boolean isAlive: this method returns true if the Person is alive; otherwise returns false.
public int compareToPerson p: this method satisfies the requirements from implementing the Comparable interface. Younger people are "larger". Note: this method must use its born variable's compareToDate d method.
This class overrides the public String toString method, which returns a String in one of these two exact formats:
a Alive people example: "Tiger Woods was born and is still alive"
b Dead people example: "Albert Einstein was born and died
Use the name variable's getPrettyName method, and the borndied getYyyyMmDd method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started