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

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

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 SortAuthByNames (Java Application) C:\Program Author: Deborah Hopkinson Book: Sky Boys --------- Author: Nalo Hopkinson Book: Brown Girl in the Ring - - - - - - - - Author: George R. R. Martin Book: Song of Ice and Fire --------- Author: Frank Miller Book: 300 - - - - - - - - - Author: Henry Miller Book: Tropic of Cancer

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!