Question: public class Library { /** Unique books in the library. */ private Book[] books; /** Number of copies for each book. */ private int[] copies;
public class Library { /** Unique books in the library. */ private Book[] books; /** Number of copies for each book. */ private int[] copies; /** Number of copies currently checked out for each book. */ private int[] checkedOut; /** Number of unique books in the library. */ private int numBooks; /** Construct a new empty Library. */ public Library(int librarySize) { books = new Book[librarySize]; copies = new int[librarySize]; checkedOut = new int[librarySize]; numBooks = 0; }
/** * Add a single book the library. * * If the book is already present, adds another copy. * If the book is new, add it after the existing books. * @param b Book to add. */ public void addBook( Book b ) { } /** * Checks out a book from the library if possible. * @param b Book to check out. * @return String denoting success or failure. */ public String checkOutBook (Book b) { return ""; } /** * Checks in a book to the library if possible. * @param b Book to check in. * @return String denoting success or failure. */ public String checkInBook ( Book b ) { return ""; } /** * Get string representation of entire library collection and status. * @return String representation of library. */
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
