Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 Book.java class represents book objects which contain the following fields title: a string which represents the book title. author: a string to hold the book author name year: book publication year isbn: a string of 10 numeric numbers. The book class will have also 3 constructors. -The default no argument constructor - A constructor which takes the title and author names only -A constructor which takes title, author and,year For the book class, you need to add all setters and getters methods such as setTitle / getTitle setAuthor/getAuthor setYear/getYear setISBN/getISBN finally, define a bookInfo() method which will print the book information in the following format Book Title: book title Author(S): author Publication Year : the year ISBN : the isbn number

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Android Graphics

Authors: Wallace Jackson

1st Edition

1430257857, 978-1430257851

More Books

Students also viewed these Programming questions