Library M S Final Project

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 25

Green University of Bangladesh

Department of Computer Science and Engineering (CSE)


Semester: (Spring, Year: 2024), B.Sc. in CSE (Day)

Library Management System

Course Title: Operating System Lab


Course Code: CSE 310
Section: 221– D8
Students Details
Name ID
Md. Shahriar Abu Shakib 221002323
Nurjahan khanom oishi 213002184
Submission Date: 12-06-2024
Course Teacher’s Name: Md Fahimul Islam

[For teachers use only: Don’t write anything inside this box]

Lab Project Status


Marks: Signature:

Comments: Date:

Contents
1 Introduction ................................................................................................................................... 3
1.1 Overview ..................................................................................................................................... 3
1.2 Motivation .................................................................................................................................. 3
1.3 Problem Definition .................................................................................................................... 3
1.3.1 Problem Statement ................................................................................................................3
1.3.2 Complex Engineering Problem ............................................................................................. 4
1.4 Design Goals/Objectives ...........................................................................................................4
1.5 Application ..................................................................................................................................5
2 Implementation of the Project ................................................................................................... 6
2.1 Implementation ......................................................................................................................... 6
2.1.1 Define Constants .................................................................................................................... 6
2.1.2 Define Variables ......................................................................................................................6
2.1.3 Main Menu Function ............................................................................................................. 6
2.1.4 User Management Panel .......................................................................................................7
2.1.5 Book Management Panel ...................................................................................................... 8
2.1.6 End Screen Function .............................................................................................................. 8
2.1.7 User Management Functions ............................................................................................... 9
2.1.8 Modify User .............................................................................................................................9
2.1.9 List User ................................................................................................................................. 10
2.1.10 Search User ......................................................................................................................... 10
2.1.11 Delete User ......................................................................................................................... 11
2.1.12 Book Management Functions .......................................................................................... 11
2.1.13 Add Book ............................................................................................................................. 11
2.1.14 Modify Book ........................................................................................................................12

1
2.1.15 List Book .............................................................................................................................. 12
2.1.16 Search Book ........................................................................................................................ 13
2.1.17 Delete Book .........................................................................................................................13
2.1.18 Rent Book ............................................................................................................................ 14
2.1.19 List Rentals .......................................................................................................................... 14
2.1.20 Main Program Execution ...................................................................................................15
2.2 Algorithms ................................................................................................................................ 15
3 Performance Evaluation .............................................................................................................20
3.1 Results Analysis/Testing ......................................................................................................... 20
3.1.1 Main Menu ............................................................................................................................20
3.1.2 User Panel ..............................................................................................................................20
3.1.3 Add User ................................................................................................................................ 21
3.1.4 List of Users Record ..............................................................................................................21
3.1.5 Search users .......................................................................................................................... 21
3.1.6 Book Panel .............................................................................................................................22
3.1.7 Add Book ............................................................................................................................... 22
3.1.8 List Book .................................................................................................................................22
3.1.9 Search Book ...........................................................................................................................23
3.1.10 End Program ....................................................................................................................... 23
3.2 Results Overall Discussion ...................................................................................................... 23
4 Conclusion ....................................................................................................................................24
4.1 Discussion ................................................................................................................................. 24
4.2 Limitations ................................................................................................................................ 24
4.3 Scope of Future Work ............................................................................................................. 24

Chapter 1

2
Introduction

1.1 Overview
This Bash script project is a command-line Library Management System that allows
users to manage library records. It provides menus for both user and book
management panels, where users can add, modify, list, search, and delete records
for both users and books. Additionally, the system supports book rentals, tracking
rented books and updating book quantities accordingly. User interactions and data
manipulations are managed through text files for persistent storage, ensuring that all
records are maintained across sessions.

1.2 Motivation
• Streamlined Library Operations: Simplifies management of user and book
records in a library setting.

• User-Friendly Interface: Provides an intuitive command-line interface for easy


navigation and operation.

• Persistent Data Storage: Ensures data is stored and accessible across sessions
using text files.

• Automation of Routine Tasks:Automates adding, modifying, listing, searching,


and deleting records, saving time and effort.

• Resource Management:Helps in tracking book rentals and maintaining


accurate book stock records.

• Learning Experience:Offers practical experience in scripting, file handling, and


user interface design using Bash.

1.3 Problem Definition

1.3.1 Problem Statement


Managing library operations manually is time-consuming and error-prone. This
project aims to create a Bash-based Library Management System to automate user
registrations, book inventories, and rentals, providing an efficient and user-friendly
interface for library staff.

3
1.3.2 Complex Engineering Problem
To address the attributes of a complex engineering problem for the Library
Management System project, the table can be filled as follows:

Table 1.1: Summary of the attributes touched by the Library management project
Name of the P Attributess Explain how to address
P1: Depth of knowledge required Understanding of Bash scripting and file
handling is crucial to develop the system.
P2: Range of conflicting Balancing user-friendly interface with robust
requirements functionality for library staff and patrons.
P3: Depth of analysis required In-depth analysis of library processes and user
needs to ensure all functionalities are
covered.
P4: Familiarity of issues Awareness of common library management
challenges like inventory tracking and user
management.
P5: Extent of applicable codes Adherence to coding standards and best
practices in Bash scripting to ensure
maintainability.
P6: Extent of stakeholder Involving library staff for requirements
involvement and conflicting gathering and feedback to align the system
requirements with actual needs.
P7: Interdependence Ensuring seamless integration of different
system modules like user management, book
management, and rental management.
1.4 Design Goals/Objectives
• Enhance Library Efficiency: Improve the management of library operations.

• Automate Record Management:Streamline adding, modifying, listing,


searching, and deleting user and book records.

• Track Book Rentals: Accurately manage and monitor book rental activities.

• Maintain Data Integrity:Ensure persistent and reliable storage of user and book
information.
• Improve User Experience:Provide a simple and intuitive interface for library
staff and users.

• Develop Scripting Skills:Gain practical experience in Bash scripting and file


handling techniques.

4
1.5 Application
• VMware Workstation 17 Player.

• Kali Linux.

5
Chapter 2

Implementation of the Project

2.1 Implementation

2.1.1 Define Constants

These lines define constants for the ASCII values of the ENTER, TAB, and BACKSPACE
keys. However, these constants are not used anywhere in the script.

2.1.2 Define Variables

These lines initialize variables. passTerminator and bookStock are set to 1 and 0
respectively, while rentName and bookName are initialized as empty strings. These
variables are not used in the script.

2.1.3 Main Menu Function


This function displays the main menu, reads user input, and directs to either the User
Management Panel or the Book Management Panel based on the input. If the input
is invalid, it displays an error message and re-displays the menu after a short delay.

6
2.1.4 User Management Panel

This function displays the User Management Panel menu, reads user input, and
directs to the appropriate function based on the input. If the input is invalid, it
displays an error message and re-displays the menu after a short delay.

7
2.1.5 Book Management Panel

This function displays the Book Management Panel menu, reads user input, and
directs to the appropriate function based on the input. If the input is invalid, it
displays an error message and re-displays the menu after a short delay.

2.1.6 End Screen Function

This function clears the screen, displays a thank you message, and exits the script.

8
2.1.7 User Management Functions

This function allows adding user records. It prompts the user for details, appends
the details to userRecords.txt, and asks if more records should be entered. If not, it
redirects to the User Panel.

2.1.8 Modify User

This function modifies user details. It searches for a user by first name, allows
modifications if found, and updates the user record. If not found, it informs the user
and redirects to the User Panel.

9
2.1.9 List User

This function lists all user records, displaying each user’s details in a formatted
manner. It waits for user input before redirecting to the User Panel.

2.1.10 Search User

This function searches for a user by first name and displays the full record if
found. If not found, it informs the user. It waits for user input before redirecting to
the User Panel.

10
2.1.11 Delete User

This function deletes a user record by first name. It searches for the user,
removes the record if found, and updates the user records file. If not found, it
informs the user and redirects to the User Panel after a short delay.

2.1.12 Book Management Functions

2.1.13 Add Book

This function allows adding book records. It prompts the user for details, appends
the details to bookRecords.txt, and asks if more records should be entered. If not, it
redirects to the Book Panel.

11
2.1.14 Modify Book

This function modifies book details. It searches for a book by name, allows
modifications if found, and updates the book record. If not found, it informs the user
and redirects to the Book Panel.

2.1.15 List Book

This function lists all book records, displaying each book’s details in a formatted
manner. It waits for user input before redirecting to the Book Panel.

12
2.1.16 Search Book

This function searches for a book by name and displays the full record if found. If
not found, it informs the user. It waits for user input before redirecting to the Book
Panel.

2.1.17 Delete Book

This function deletes a book record by name. It searches for the book, removes
the record if found, and updates the book records file. If not found, it informs the
user and redirects to the Book Panel after a short delay.

13
2.1.18 Rent Book

This function handles book rentals. It searches for a book by name, allows the
user to rent the book if it is in stock, updates the book quantity, and records the
rental details. If the book is out of stock or not found, it informs the user. It waits for
user input before redirecting to the Book Panel.
2.1.19 List Rentals

14
This function lists all rental records and waits for user input before redirecting to
the User Panel.

2.1.20 Main Program Execution

This line starts the script by calling the menu function, which displays the main
menu and handles user navigation through the library management system.

2.2 Algorithms
1. Initialize Constants and Variables:

• Define constants ENTER=13, TAB=9, BKSP=8.


• Initialize variables passTerminator=1, bookStock=0, rentName="",
bookName="".

2. Main Menu Function (menu)

• Clear the screen.


• Display the main menu options: "User Management Panel" and "Book
Management Panel".
• Read user input.
• Depending on user input, call either userPanel or bookPanel.
• If input is invalid, display an error message and recall menu.

3. User Management Panel (userPanel)

• Clear the screen.


• Display the user panel options: Add User, Modify User, List User, List
Rentals, Search User, Delete User, Open Main Menu, Close the Program.
• Read user input.
• Call the appropriate function based on the input.
• If input is invalid, display an error message and recall userPanel.

4. Book Management Panel (bookPanel)

• Clear the screen.


• Display the book panel options: Add Book, Modify Book, List Book, Rent
Book, Search Book, Delete Book, Open Main Menu, Close the Program.

15
• Read user input.
• Call the appropriate function based on the input.
• If input is invalid, display an error message and recall bookPanel.

5. End Screen Function (endScreen)

• Clear the screen.


• Display a thank you message.
• Exit the program.

6. Add User (addUser)

• Clear the screen.


• Prompt for user details (First Name, Last Name, Gender, Student ID, Phone
Number).

16

Append the user details to userRecords.txt.
• Confirm the addition and ask if the user wants to add more records.
• If no, redirect to userPanel.

7. Modify User (modifyUser)

• Clear the screen.


• Prompt for the name of the user to modify.
• Search userRecords.txt for the user.
• If found, prompt for new details and update the record.
• If not found, display an error message.
• Redirect to userPanel.

8. List Users (listUser)

• Clear the screen.


• Read and display each user’s details from userRecords.txt.
• Wait for user input to return to userPanel.

9. Search User (searchUser)

• Clear the screen.


• Prompt for the user’s first name.
• Search userRecords.txt for the user.
• Display the user’s details if found, otherwise display an error
message.
• Wait for user input to return to userPanel.

10. Delete User (deleteUser)

• Clear the screen.


• Prompt for the name of the user to delete.
• Search userRecords.txt for the user.
• If found, delete the user’s record.
• If not found, display an error message.
• Redirect to userPanel.

11. Add Book (addBook)

• Clear the screen.

17

• Prompt for book details (Name, Author, Publisher, Book ID, Quantity).
• Append the book details to bookRecords.txt.
• Confirm the addition and ask if the user wants to add more records.
• If no, redirect to bookPanel.

12. Modify Book (modifyBook)

Clear the screen.


• Prompt for the name of the book to modify.
• Search bookRecords.txt for the book.
• If found, prompt for new details and update the record.
• If not found, display an error message.
• Redirect to bookPanel.

13. List Books (listBook)

• Clear the screen.


• Read and display each book’s details from bookRecords.txt.
• Wait for user input to return to bookPanel.

14. Search Book (searchBook)

• Clear the screen.


• Prompt for the book’s name.
• Search bookRecords.txt for the book.
• Display the book’s details if found, otherwise display an error
message.
• Wait for user input to return to bookPanel.

15. Delete Book (deleteBook)

• Clear the screen.


• Prompt for the name of the book to delete.
• Search bookRecords.txt for the book.
• If found, delete the book’s record.
• If not found, display an error message.
• Redirect to bookPanel.

16. Rent Book (rentBook)

18

• Clear the screen.
• Prompt for the name of the book to rent.
• Search bookRecords.txt for the book.
• If found and quantity is greater than zero, prompt for user details
and update the book’s quantity.
• If not found or out of stock, display an error message.
• Wait for user input to return to bookPanel.

17. List Rentals (rentList)

• Clear the screen.


• Read and display each rental record from rentRecords.txt.
Wait for user input to return to userPanel.

18. Restart the Program

• Call the menu function.

19
Chapter 3

Performance Evaluation

3.1 Results Analysis/Testing

3.1.1 Main Menu

In the main menu, we have to see two option.User management panel and Book
management panel. If we choose the user panel -

3.1.2 User Panel

In the user management panel, we have to see more eight option. Every option have
different type of work.

20
3.1.3 Add User

In this section, we add user to fill up many option and added.

3.1.4 List of Users Record

In this section, we have to see the list of users.

3.1.5 Search users

Search any user in this section.

21
3.1.6 Book Panel

In this figure, we have to see the Book management panel and see the eight option
in this interface.

3.1.7 Add Book

So, we selected in the number one option and add book of this library program.

3.1.8 List Book

22
This is the list book section. Data store in text files.

3.1.9 Search Book

In this section, we have to search any type of books that we want.

3.1.10 End Program

3.2 Results Overall Discussion


The Library Management System project demonstrates the effectiveness of using a
Bash script for basic library operations. It successfully implements functionalities for
user and book management, including adding, modifying, listing, searching, and
deleting records, as well as handling book rentals. The script provides a simple and
accessible command-line interface, ensuring ease of use. However, it is limited by
the constraints of the Bash environment, such as lack of concurrency and
sophisticated error handling. Despite these limitations, the project illustrates the
potential of shell scripting in automating administrative tasks and offers a solid
foundation for further enhancements and integration with more advanced
technologies.

Chapter 4

23
Conclusion

4.1 Discussion
This project implements a Library Management System using a Bash script. It allows
adding, modifying, listing, searching, and deleting user and book records. Users can
also rent books, and the system keeps track of these rentals. The menu-driven interface simplifies
navigation and management of library tasks, storing data in text files for easy access and updates. c

4.2 Limitations
• Limited to command-line interface; no graphical user interface.

• Data stored in plain text files, lacking database security and scalability.

• No input validation, risking incorrect or inconsistent data entries.

• Single-user access, no concurrent multi-user functionality.

• Basic error handling, with potential for unhandled exceptions.

• Manual backup and restore process for records.

4.3 Scope of Future Work


Future work includes adding a graphical user interface, integrating a database,
implementing input validation, enabling multi-user access, automating backups, and
adding features like book reservation, notifications, and analytics.

References
• https://www.geeksforgeeks.org/implementing-directory-management-using-shell-s •

https://www.naukri.com/code360/library/implementing-directory-management-usin

• https://www.freecodecamp.org/news/bash-scripting-tutorial-linux-shell-script-

24

You might also like