Answered step by step
Verified Expert Solution
Question
1 Approved Answer
It is required to develop an application called Library System to maintain information aboutbooks and members in a library. ( 1 ) Write a class
It is required to develop an application called Library System to maintain information aboutbooks and members in a library. Write a class called Book having the following data members:title String authorl String authorString publisher String yearPublication intisbn String accessionNum long issuedTo LibMemberInclude following public methods in the class:Default constructor without any parameters constructor with parameters except forissuedTo initialize issuedTo to null set and get methods for all attributes, equals andtoString.NOTE: The SBN is a unique digit number assigned by the publisher. It is like barcode. Asthere can be multiple copies of a book in a library, the libraries assign a unique number,called accession number, to every book in the library to keep track of the books in thelibrary. Assume that accession number starts from Write a class called LibMember having the following data members:firstName String lastName String gender char cprNum long teleNum Stringbookslssued array of type Book, size and numBooksissued intInclude following public methods in the class:Default constructor without any parameters constructor with parameters except forbooksissued and numBookslssued initialize nubBikslssued to set and get methods forall attributes, equals and toString. Write a class called LibrarySystem having the following data members:bookslist:membersList: list of members LinkedList object, each element is of type LibMember,booksListSize: actual number of objects of type Book in booksList,list of books LinkedList object, each element is of type Book, Constructor without any parameters. Create booksList and membersList as empty linkedlists and initialize booksListSize and memberslistSize to addBook:inserts a new Bookobject at the end of the booksList. Object of type Bookis passed as parameter. If the object already exists in the list, then do not add the objectand return false, else return true after successfully adding the Book.ii deleteBook: deletes a Book object from bookslist. Accession number of the Book ispassed as parameter. If the Book is issued to a member or the object is not found in thebooksList, then the Book cannot be deleted and the method returns false, else themethod returns true, after successfully deleting the object.iv addMember: inserts a new LibMember object at the end of the memberslist. Object oftype LibMember is passed as parameter. If the object already exists in the list, then donot add the object and return false, else return true after successfully adding themember.v deleteMember: deletes a LibMember object from memberslist. CPR number of theLibMember is passed as parameter. If any Book is issued to the member or the object isnot found in the memberslist, then the member cannot be deleted and the methodreturns false, else the method returns true, after successfully deleting the object.vi searchBook: searches the booksList by accessionNum, passed as parameter. If theobject is found, it returns its location in the bookslist, else returns vii searchMember: searches the memberslist by cprNum, passed as parameter. If theobject is found, it returns its location in the membersList, else returns vii isEmptyBooksList: returns true if the booksList is empty, else returns false.,ix isEmptyMembersList: returns true if the membersList is empty, else returns false.x sizeBooksList: returns instance variable booksListSize.xi sizeMembersList: returns instance variable membersListSize.xii issueBook: accepts accession number of a Book as the first parameter and the CPRnumber of the member as the second parameter. The Book can be issued toa memberonly if:a The Book exists in the booksList,bThe member exists in the membersList,c The Book is not issued to any member,d The member has less than books issued to himherIf the book can be ssued to a member, then add the Book object in the bookslssuedarray for the member, increment numBookslssuedby for the member and also makeissuedTo instance variable of the Book object reference to the member and returntrue. If the Book cannot be issued then return false.Note that there will be cross referencing between the book and the member.xiii return Book: accepts accession number ofa Book as the parameter. The Book can bereturned only if:a The Book exists in the Books list,b The Book is issued to a member.If the Book can be returned, then delete it from bookslssued array for the member,decrement numBookslssued by one for the member and also make issuedTo instancevariable of the Book object to null and return true. If the Book cannot be returned,then return false.xiv printBookslssued: accepts CPR number of a member as a parameter and prints detailsof all the books issued to the member.xv isBookissued: accepts accession number of the Book as parameter. It returns true if theBook object exists in the bookist and is is
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