QUESTION

Library Management System A. Description The information of available books in a library are stored in “booksInfo.txt” file, such that each line represents a record that corresponds to a unique book. Each record contains the following information: • Serial Number (5 digits) • Title • authors • price • number of available copies in the library • number of borrowed copies In each record: The above items are separated by commas, and authors are separated with colons. The information of borrowed books is stored in “borrowedInfo.txt” file. Each line in this file represents a record that contains the serial number of the book and the id of the borrower. These information are separated by a comma. You are required to develop a menu-driven program that display the following menu and keep displaying it until the user chooses the exit option. Library Management System ============================== 1. Print books info 2. Search a book 3. Add new book 4. Remove a book 5. Borrow a book 6. Return a book 7. Exit =============================== Enter your choice: Below are the details for each possible choice: Page 2 of 4 1. Print books info The following information should be displayed for all books in the library: serial number, title, number of authors, price, total number of copies (available in library + borrowed) 2. Search a book The user can choose to search for a book by entering either its title (or part of it), or by entering the name of one of its authors (or part of it). You should display all information of all matched books, otherwise an appropriate message is displayed to indicate that there are no matched books. Searching should be case insensitive; user can search using lowercase or uppercase letters. 3. Add a new book To add a new book, the user should enter required information except the number of borrowed copies. User can enter multiple authors for one book, the serial number should be unique for each book in the library. The entered information should be validated as follows: book serial number should be 5 digits and it should not be equal to any other used serial number, title is not empty, at least one author name is entered, price is a valid float positive number, and number of available copies is valid positive integer number. After the user enters complete valid information for a new book, a new record should be added to the “booksInfo.txt” file (in this case, the number of borrowed copies will be equal to 0), and a message is displayed to indicate that the new book has been added successfully. Otherwise, appropriate wrong messages should be displayed about all invalid inputs. 4. Remove a book To remove a book, a user should enter a valid existing serial number. Then, all information of the book is displayed, and the user should be asked whether he is sure about removing the book. If the user confirms removing the book, the corresponding record should be deleted from (booksInfo.txt) file. A message is displayed to indicate that the book has been removed successfully. Note that a book can be removed only if it has no borrowed copies. Appropriate error messages should be displayed if the user entered invalid/non-existing serial number, or if the book has some borrowed copies. 5. Borrow a book A user can borrow up to 3 books, a user cannot borrow more than one copy of the same book at the same time. To borrow a book, the user should enter the serial number of the book and his id, then a new record is added to the file “borrowedInfo.txt”. The corresponding record in “booksInfo.txt” file should be modified such that the number of available copies in library are decremented by 1, and the number of borrowed copies is incremented by 1. A message is Page 3 of 4 displayed to indicate that the book has been borrowed successfully. Note that a book cannot be borrowed under the following conditions: user entered invalid/non-existing book serial number, user already borrowed 3 books, user already borrowed a copy of the same book or if all copies of the book are borrowed (i.e. no available copies in the library). 6. Return a book A user can return a book that he borrowed before. To return a book, the user should enter the serial number of the book and his id. If a matched record is found in the “borrowedInfo.txt” file, then remove that record. Also, the corresponding record in “booksInfo.txt” file should be modified such that the number of available copies in library are incremented by 1, and the number of borrowed copies is decremented by 1. A message is displayed to indicate that the book has been returned successfully. If no match is found, an appropriate error message is displayed. If user entered an invalid menu option, the program should display an appropriate error message. B. Deliverables: Each team should submit the following: 1. Working code written in a jupyter notebook file, the file should include the names, ids, section numbers of team members at the beginning. 2. A report as a separate word file that includes the following: • Description of how the team solved the problem • Contribution of each team member • Description of the different functions with their tasks • Screen shots of the running code.

Please follow the instruction

Public Answer

BPAC2V The First Answerer