1. Create a Book record that implements the Comparable interface, comparing the Book objects by year - title: String <> - author: String - year: int Book + compareTo(other Book: Book): int + toString(): String Submit your source code on Canvas (Copy your code to text box or upload.java file) <> Comparable 2. Create a main method in Book record. 1) In the main method, create an array of 2 objects of Book with your choice of title, author, and year. 2) Sort the array by year 3) Print the object. Override the toString in Book to match the example output: @Javadoc Declaration Console X Properties Book [Java Application] /Users/kuan/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspo [Book: year=1901, Book: year=2010]
1. Create a Book record that implements the Comparable interface, comparing the Book objects by year - title: String <> - author: String - year: int Book + compareTo(other Book: Book): int + toString(): String Submit your source code on Canvas (Copy your code to text box or upload.java file) <> Comparable 2. Create a main method in Book record. 1) In the main method, create an array of 2 objects of Book with your choice of title, author, and year. 2) Sort the array by year 3) Print the object. Override the toString in Book to match the example output: @Javadoc Declaration Console X Properties Book [Java Application] /Users/kuan/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspo [Book: year=1901, Book: year=2010]
Chapter22: Integrating Word, Excel, Access, And Powerpoint
Section: Chapter Questions
Problem 1QY
Related questions
Question
![1. Create a Book record that implements the Comparable interface, comparing the
Book objects by year
- title: String
<<record>>
- author: String
- year: int
Book
+ compareTo(other Book: Book): int
+ toString(): String
Submit your source code on Canvas (Copy
your code to text box or upload.java file)
<<interface>>
Comparable<Book>
2. Create a main method in Book record.
1) In the main method, create an array of 2 objects of Book with your choice of
title, author, and year.
2) Sort the array by year
3) Print the object. Override the toString in Book to match the example output:
@Javadoc Declaration Console X Properties
<terminated> Book [Java Application] /Users/kuan/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspo
[Book: year=1901, Book: year=2010]](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1f1cff89-d0c3-401a-ba77-d9b5f81fcda4%2F72b65b77-1c20-421d-bf66-22c80280cee2%2Flj1s6oi_processed.png&w=3840&q=75)
Transcribed Image Text:1. Create a Book record that implements the Comparable interface, comparing the
Book objects by year
- title: String
<<record>>
- author: String
- year: int
Book
+ compareTo(other Book: Book): int
+ toString(): String
Submit your source code on Canvas (Copy
your code to text box or upload.java file)
<<interface>>
Comparable<Book>
2. Create a main method in Book record.
1) In the main method, create an array of 2 objects of Book with your choice of
title, author, and year.
2) Sort the array by year
3) Print the object. Override the toString in Book to match the example output:
@Javadoc Declaration Console X Properties
<terminated> Book [Java Application] /Users/kuan/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspo
[Book: year=1901, Book: year=2010]
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT