Question: In Java Programming language Suppose we are designing a program to sort authors by their names. Author class has the following characteristics: o Implements Comparable

Suppose we are designing a program to sort authors by their names. Author class has the following characteristics: o Implements Comparable interface. An author has first name, last name, and book. o A constructor that sets the previous 3 properties. o A compare To method that compares authors based on their names, starting with last name. A class that has the main method, In main: You are creating an arraylist of 5 authors, for example: Author: Deborah Hopkinson Book: Sky Boys Author: Frank Miller Book: 300 Author: Nalo Hopkinson Book: Brown Girl in the Ring Author: Henry Miller Book: Tropic of Cancer Author: George R. R. Martin Book: Song of Ice and Fire Sorting the authors arraylist contents. [Explanation: this is using the Compare To method in the Author class). A loop to print authors and their books in a sorted manner. Output: : Problems @ Javadoc Declaration Console X
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
