Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This class implements the Comparable interface ( details below ) . This class has instance variables and accessor methods for Date born, Date died, and

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 die(Date 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 compareTo(Person p): this method satisfies the requirements from implementing the Comparable interface. Younger people are "larger". Note: this method must use its born variable's compareTo(Date 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 1975-12-30 and is still alive"
b) Dead people example: "Albert Einstein was born 1879-03-14 and died 1955-04-18"
Use the name variable's getPrettyName() method, and the born/died getYyyyMmDd() method

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

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions

Question

5. Provide opportunities for retesting when the stakes are high.

Answered: 1 week ago

Question

Please I need someone to solve ASAP uble x=5.5; y=(int)x True False

Answered: 1 week ago