TestLibrary.java Design and implement a class named Book. A book has a serial number, a title, an...

70.2K

Verified Solution

Question

Programming

TestLibrary.java

Design and implement a class named Book. A book has a serialnumber, a title, an author, and a publisher. Create appropriateconstructor(s) and accessor and mutator methods for the Bookclass.

Add a static variable to the Book class and set its initialvalue to 100000000. When a new book is created, this staticvariable is automatically incremented by 1 and the new value isassigned as the serial number of the new book.

Design and implement a class named Library. A library has alibrary name (such as Surrey Central Library), a list of books(which is an array of Book objects. Assume that the maximum numberof books for a library is 10000), and the actual number of books inthe library. Create a constructor for creating a library objectwith a given library name. Create a method for adding a book to thelibrary and another method for returning the array of all books.Add another method to get the number of books in the library.

In the main method, create a new library object and create a fewbooks. Add the books to the library. Get the list of books anddisplay their serial numbers, titles, author names, andpublishers.

Answer & Explanation Solved by verified expert
4.4 Ratings (1087 Votes)
Bookjavapublic class Book private int serial private String title private String author private String publisher private static int IV 100000 public BookString title String author    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students