Question: 1 0 . Consider the code snippet below. You have to write a program that models a library with books. Each book has a unique

10. Consider the code snippet below. You have to write a program that models a library with books. Each book has a unique identification number, title, and author. The identification number is auto-generated and auto-incremented for each book added to the library's catalog. The library's name and address are fixed for all books.[3+3+4=10 Marks] For example: If two books, "To Kill a Mockingbird" by Harper Lee and "1984" by George Orwell are added, the output should be:Library Name: Central LibraryLibrary Address: 123 Main StBook ID: 1Book Title: To Kill a MockingbirdBook Author: Harper Lee Library Name: Central LibraryLibrary Address: 123 Main StBook ID: 2Book Title: 1984Book Author: George Orwell To assist with the task, a Book class and a Library class with a main method are given in the program. You have to fill the missing code in each class and method.A. Book class - This class should have static and final variables for book counter, library name, and library address. It should also have a constructor that takes the title and author as arguments and auto-generates the identification number.B. displayBookDetails()- This method should display the library name, library address, book ID, book title, and book author in the given format. Java code:class Book {/*___MISSING CODE (A)___*/ private int id; private String title; private String author; public Book(String title, String author){ this.title = title; this.author = author; /*___MISSING CODE (B)___*/} public void displayBookDetails(){/*___MISSING CODE (C)___*/}} public class Library { public static void main(String[] args){ Book book1= new Book("To Kill a Mockingbird", "Harper Lee"); book1.displayBookDetails(); Book book2= new Book("1984", "George Orwell"); book2.displayBookDetails(); }}

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 Programming Questions!