Question: Using Java to create the following classes below. 1. Create a Book class: a) There are fields for the authors first and last names (use

Using Java to create the following classes below.

1. Create a Book class:

a) There are fields for the authors first and last names (use a Name class you create), the title of the book (make this protected, not private), and the year published (an int). b) Create a constructor that accepts parameters for all four fields. c) The constructor must call its own mutator methods for the following behaviors (d, e, below). d) The setYearPublished mutator must throw an InvalidBookDateException (you will have to create this class) if the date parameter is greater than 2016. e) The setFirstName, setLastName, and setTitle mutators must throw an InvalidArgumentException (you will have to create this class) if their parameter is null or an empty string. Call these methods from the constructor. f) Provide accessors, mutators, equals(), hashCode(), and a toString() method. The accessors and mutators are final. g) Implement Comparable; more-recent books are bigger.

2. Create a Bookstore class:

a) There is a single field which is an ArrayList. b) Implement an addBook() method which tries to create a new Book and adds it to the Bookstore. The addBook() method should accept parameters for the new Book authors first and last names, the title of the book, and the year published; it must also catch any thrown Exceptions. c) Implement a displayBooks() method which prints books before and after sorting them.

3. Create a Biography class, which is final. It extends Book. It adds a field called subject which is a Name object. Override equals again; books are equal if they are biographies of the same subject.

And Obviously a Main class(tester) if it needs one.

Please follow the instructions above for a good rate.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!