Answered step by step
Verified Expert Solution
Link Copied!

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.(1) Write a class called Book having the following data members:title (String), authorl (String), author2(String), publisher (String), yearPublication (int),isbn (String), accessionNum (long), issuedTo (LibMember).Include following public methods in the class:Default constructor (without any parameters), constructor with 6 parameters (except forissuedTo - initialize issuedTo to null), set and get methods for all attributes, equals andtoString.NOTE: The (SBN is a unique 13 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 1001.(2) Write a class called LibMember having the following data members:firstName (String), lastName (String), gender (char), cprNum (long), teleNum (String),bookslssued (array of type Book, size =10) and numBooksissued (int).Include following public methods in the class:Default constructor (without any parameters), constructor with 5 parameters (except forbooksissued and numBookslssued - initialize nubBikslssued to 0), set and get methods forall attributes, equals and toString.(3) 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,(0) Constructor without any parameters. Create booksList and membersList as empty linkedlists and initialize booksListSize and memberslistSize to 0.() 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 -1.(vii) searchMember: searches the memberslist by cprNum, passed as parameter. If theobject is found, it returns its location in the membersList, else returns -1.(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,(b)The member exists in the membersList,(c) The Book is not issued to any member,(d) The member has less than 10 books issued to him/her.If the book can be ssued to a member, then add the Book object in the bookslssuedarray for the member, increment numBookslssuedby 1 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

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

Students also viewed these Databases questions

Question

Discuss communication challenges in a global environment.

Answered: 1 week ago