SEHH2042 Computer Programming Group Project – Library Management System
Expected Learning Outcomes • familiarise themselves with at least one high level language programming environment. • develop a structured and documented computer program. • understand the fundamentals of object-oriented programming and apply it in computer program development. • apply the computer programming techniques to solve practical problems. Introduction In this project, you are going to develop a Library Management System that runs in the command line environment. Library administrator (i.e. the user) will use the system to manage book inventory and borrow/return process. This is a group project. You need to form a group with 5 to 6 members. Your group will write a Win32 Console Application program called library.cpp. The requirements are listed below. System Requirements R0 When the program starts, the system asks whether the user wants to import (1) the book list and (2) the borrower list from files. If the user inputs ‘Y’, he/she will be asked to further input the path of the .csv file. If the user inputs ‘N’, then this step will be skipped. Import book list from file? [Y/N]: Y Path of book list file: C:\BookList.csv Importing book list . . . Done Import borrower list from file? [Y/N]: N No borrower list is imported Hint: The codes of file input will be given. It reads the .csv file line by line using a loop. In each round of the loop, ONE LINE of the file is read and stored in a string. You need to extract the corresponding elements from the string. Refer to appendix for the data format in the .csv file.
After the file import process, the console should display a welcome message, and then the main menu of the Library Management System. The user can enter the options of the corresponding actions (see R1 to R7 below). Library Management System [1] Manage books [2] Manage borrowers [3] Borrow book(s) [4] Return book(s) [5] Useful feature(s) added [6] Member List [7] Exit *** Option (1 - 7): R1 Manage Books When the user inputs 1 in the main menu, the system allows the user to perform various actions related to books. User can choose a specific action from the “Manage Books” menu below: * Manage Books * [1] Display books [2] Search book [3] Add book [4] Remove book [5] Back **** Option (1 - 5): R1.1 Display books In this option, the book list is displayed on screen in alphabetical order of book title. The list is displayed in table format with 3 columns: “ID”, “Book details” and “Availability”. Book details should include “Title”, “Author”, “Publisher” and “Year” (See R1.3). You may design your own layout to display the book details, or refer to the sample layout given in the table below: ID Book Details Availability SEHH2042 C++ Language for Beginners C. K. Tsang, Ken; H.S. Chiu HKCC IT Publication (2023) Yes ttssttes SEHH2042 2022-23 Semester 2 – Group Project Page 3 of 12 IT2042-01A Object-oriented design using C++ David Chu; Jimmy Hui; Michael Yeung; Russell Lo 2042 Subject Team Ltd. (2020) No After displaying the book list, the system displays the “Manage Books” menu. R1.2 Search books In this option, the user can search for books using keywords (a string with maximum 50 characters). The user can enter one or more keywords separated by space, and with or without double quotes. The meanings of input are given below: Input Meaning Single keyword (e.g. c++) Any fields that contain the keyword, case insensitive. (e.g. C++ Programming, Introduction to C++, etc.) Multiple keywords (e.g. c++ language) Any fields that contain any of the keywords (OR operation), case insensitive. (e.g. C++ Programming, Introduction to C++ Language, Japanese Language for Beginners, etc.) With double quote (e.g. “C++ Language”) Any fields that contain the exact input phrase, case sensitive. (e.g. C++ Language for Beginners, Introduction to C++ Language, etc.) If the keywords appear in any of ID, Title, Author, or Publisher, it is considered as a match. The search result is displayed using the same format as in R1.1. After displaying the search result, the system displays the “Manage Books” menu. R1.3 Add book To add a book to the system, the user needs to provide the following details: - ID (a string with maximum 10 characters, has to be unique) - Title (a string with maximum 100 characters) - Author (a string with maximum 50 characters, may contains multiple names separated by semi-colon ‘;’) - Publisher (a string with maximum 50 characters) - Year (a positive integer) tetttts SEHH2042 2022-23 Semester 2 – Group Project Page 4 of 12 When all details are provided correctly (e.g. need to check ID is unique, year is positive), the book is set to available and added to the book list maintained in the system (No need to update the book list file). You may assume that there is only 1 copy of each book in the system, but a book may have different versions published in different years. You may assume that there are at most 1000 books in the system. After the “Add book” process is done, the system displays the “Manage Books” menu. R1.4 Remove book To remove a book from the system, the user needs to provide the ID of the book. If the book is found and is available, the system displays the book details and prompts for user’s confirmation to delete. If the user confirms, then the book is removed from the book list maintained in the system (No need to update the book list file). Otherwise, no book is removed. If the book ID is not found, or the book is not available (i.e. someone has borrowed it), then appropriate message should be displayed to the user. In this case, no book should be removed. After the “Remove book” process is done, the system displays the “Manage Books” menu. R1.5 Back The system goes back to “Library Management System” and displays the main menu. R2 Manage Borrowers When the user inputs 2 in the main menu, the system allows the user to perform various actions related to borrowers. User can choose a specific action from the “Manage Borrowers” menu below: * Manage Borrowers * [1] Display borrowers [2] Search borrower [3] Add borrower [4] Remove borrower [5] Back ** Option (1 - 5): ttstttts SEHH2042 2022-23 Semester 2 – Group Project Page 5 of 12 R2.1 Display borrowers In this option, the borrower list is displayed on screen in alphabetical order of borrower’s name (last name first, and then first name). The list is displayed in table format with 4 columns: “ID”, “Name”, “Contact number” and “Number of books borrowed” (see R2.3). After displaying the borrower list, the system displays the “Manage borrowers” menu. R2.2 Search borrower In this option, the user can search for a specific borrower using the borrower ID. If there is a match. The following details of the borrower will be displayed: - ID - Name (Last name then first name, e.g. CHAN Tai Man) - Contact number - List of borrowed books (Book ID, Title, Author, Publisher and Year) After displaying the search result, the system displays the “Manage borrowers” menu. R2.3 Add borrower To add a borrower to the system, the user needs to provide the following details: - Last name (a string with maximum 10 characters, convert to UPPER case) - First name (a string with maximum 30 characters, capitalize each word) - Contact number (an 8-digit number, begins with 2, 3, 5, 6, or 9) User can input any text for last name and first name. The system then converts all characters of the last name to UPPER case, and capitalizes each word in the first name (i.e. first letter of each word is in upper case, remaining letters are in lower case). When all details are provided correctly (e.g. need to check first digit of contact number), a unique borrower ID (a string in the format HKCCxxxx, where xxxx is a number ranges from 0000 to 9999) is automatically assigned by the system, the “number of books borrowed” (a non-negative integer) is set to 0, and the borrower is added to the borrower list maintained in the system (No need to update the borrower list file). You may assume that there are at most 500 borrowers in the system. After the “Add borrower” process is done, the system displays the “Manage Borrowers” menu. tstetts SEHH2042 2022-23 Semester 2 – Group Project Page 6 of 12 R2.4 Remove borrower To remove a borrower from the system, the user needs to provide the ID of the borrower. If the borrower is found and has no books borrowed, the system displays the borrower details and prompts for user’s confirmation to delete. If user confirms, then the borrower is removed from the borrower list maintained in the system (No need to update the borrower list file). Otherwise, no borrower is removed. If the borrower ID is not found, or the borrower has borrowed book(s), then appropriate message should be displayed to the user. In this case, no borrower should be removed. After the “Remove borrower” process is done, the system displays the “Manage Borrowers” menu. R2.5 Back The system goes back to “Library Management System” and displays the main menu. R3 Borrow book(s) When the user inputs 3 in the main menu, the system allows the user to enter the borrower details and book(s) details for borrowing the book(s). The system prompts for the user input of borrower ID first. If the borrower ID is valid and the borrower still has quota to borrow more books, it then allows the user to input the book IDs one by one. If the book ID is valid and available, the book’s availability will be updated, and the book will be added to the borrower’s list of borrowed books. Each borrower can borrow at most 5 books. If the quota is used up, the borrower cannot borrow more books until some books have been returned. No books will be borrowed if the user’s remaining quota is smaller than the number of book IDs entered during the “Borrow book(s)” process. After the “Borrow book(s)” process is done, the system displays the main menu. R4 Return book(s) When the user inputs 4 in the main menu, the system allows the user to enter the borrower details and book(s) details for returning the book(s). ssttttt SEHH2042 2022-23 Semester 2 – Group Project Page 7 of 12 The system prompts for the user input of borrower ID first. If the borrower ID is valid and the borrower has borrowed some books, it then allows the user to input the book IDs one by one. If the borrower has borrowed the book, the book’s availability will be updated, and the book will be removed from the borrower’s list of borrowed books. After the “Return book(s)” process is done, the system displays the main menu. R5 Useful feature(s) added When the user inputs 5 in the main menu, the system displays the descriptions of the useful feature(s) deigned by your group. Your group can freely add any additional useful feature(s) that is/are not described in this project specification. The added feature(s) should enhance user experience. Teachers will test the feature(s) and give marks, which contribute to the creativity and critical thinking mark of the project (see R11). After displaying the feature(s), the system displays the main menu. R6 Member list When the user inputs 6 in the main menu, the system displays the personal details of group members, including student name, student ID, class and tutorial group, in ascending order to student name. After displaying the information, the system displays the main menu. R7 Exit When the user inputs 7 in the main menu, the system prompts for user’s confirmation. If the user inputs ‘y’ or ‘Y’, the program terminates. If the user inputs ‘n’ or ‘N’, the system goes back and displays the main menu. Other input is not accepted, and the system should ask the user to confirm again. Other General Requirements R8 Meaningful guidelines should be printed to assist with user’s input. Whenever an option is selected, meaningful messages should be displayed. R9 Suitable checking on user’s input is expected. Appropriate error messages should be printed whenever unexpected situation happens, e.g., input out-of-range, etc.
The use of functions (in addition to main function) and classes are expected in your program. Appropriate comments should be added in your source code file. R11 Creativity and Critical Thinking: Think of good user interface, such as displaying the book details and borrower details. Additional useful feature(s) can be added to enhance user experience. If present, describe them in R5.
Submission Source File: Each group submits one source code file (i.e., library.cpp). Peer-to-peer Evaluation: Each student evaluates the performance of group members. All submission should be done through Moodle by 23:59, 22 April 2023 (Saturday). Late submission is not allowed.