Question
You need to program a simple book library system. There are three java classes Book.java // book object class Library.java //library class A2.java //for testing
The Library.java class The library class will have the following fields An integer MAXCAPACITY. which represent the maximum number of book that the library can hold. If the library is full, no more books can be added and a warning message will be displayed. capacity which represents the number of the books currently in the library. Every time a new book is added, capacity should be incremented. storage This is basically an array of class book. It can hold only up to maximum capacity books. name a string which will represent the library name. Example Future Library
The library class will have the following methods Library( String name, int Capacity) A constructor which will take library name and maximum capacity as input and initialize the library storage and then display a welcoming message indicating the library name and capacity. Example Welcome to Future Library I can hold upto 100 books.
Class Library methods
addbook( Book aBook ) will add a book. Each time a new book is added the capacity should be increased by one. -search (Book a Book, String title) will search for a book according to its title and will return true if it is in the library and false otherwise. A2.java is a simple test class where you need to test the implemented code by establishing a library and adding books to it.
(and add this assiment also)
A3. You need to extend the previous assignment (Library) to do the following Ask the user to input a library name and maximum number of books it can hold. Create a library with the user information and print the following menu ------------------------------------------------------------------------------- | WELCOME TO BLAA BLAA BLAA LIBRARY | The library has N books ------------------------------------------------------------------------------- (A)DD New Book (L)IST All Books (F)IND a Book (D) Delete a Book (U)pdate Book Info (S)ave. (E)xit -------------------------------------------------------------------------------- The menu should always be re- printed after completing each chosen operation until the system is exited. (1) Add new book: If the user chooses (A) the system will ask him/her to add a new book by supplying all related information. (2) List all books : If the user chooses(L) the system will display all library books information line by line . (3) FIND a book: If the user chooses (F) the system will ask him to enter the book title and return a message indicating wither the book is available or not. (4)Update a book:If the user enter U the system will ask him to specify which books he want to update its information (find ) then will ask him to update the new information. (5) Bonus Question. If the user chooses (S) the system will list all the book it holds and save it to a Text file. (see how to write information to a file on the course web site, I gave an example) (6) Exit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started