Library Management System: A Case Study Report Submitted by

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

LIBRARY MANAGEMENT SYSTEM

A Case Study Report


Submitted by

Amrith Krishnan
Karthik Sumod
Keshav Sundararaman
Mahesh Madhav
Sai Sidharth Sriram

Section- CSED

Group Number: 9

Subject CODE: 19CSE100

Subject Title: Problem Solving and Algorithmic Thinking


Problem Definition
To create a cohesive and organized set of algorithms that would allow a user to
systematically access, view and manipulate (add books, delete books, edit the
details of the books, etc.) the contents of a library’s database, while inculcating
algorithmic thinking cornerstones like abstraction into the code so as to make the
user-system interaction relevant and intuitive.

Problem Decomposition
Sl. Sub Problem Name Description
No.

1. Add books This enables the admin to add books to the management system.

2. Delete books This will enable the admin to remove any book from the
management system.

3. Search for books This enables the user/admin to search for a specific book from the
management system.

4. View books list This enables the user/admin to get a complete list of available
books from the management system.

5. Edit details This enables the admin to edit any particular detail in the
management system.
Sub problem 1: Add Books
The user should be able to add new entries into the management system, along
with the corresponding code numbers based on order of entry. The code numbers
will simplify the rest of the tasks as well.

Sub problem 2: Delete Books


The user should be able to remove books from the system, with the removal of
code numbers reflected through the repositioning of the entire book collection’s
order.

Sub problem 3: Search for Books


This feature will make book discovery much easier, allowing the end user to search
for books either by their name or by their code.

Sub problem 4: View the books list


This will output the entire book repository and additionally, we will implement a
view-books-by-genre feature as well.

Sub problem 5: Edit Details


This feature allows a separate class of users - administrators - to edit book code
and name.
Abstraction
There are two types of abstraction found in our program - Firstly, we have
abstraction based on modularization of algorithms, i.e., functions. This removes
redundancy and allows another programmer to view and identify only the
relationship of the function to other parts of the program, while hiding the inner
constructs of the function itself. 
Secondly, we impose abstraction based on the role of the end user. A menu at the
beginning will differentiate between the interaction capabilities of a user and an
administrator and will withhold the ability to use those functions accordingly. 

Pattern recognition
A survey of other general management systems, anything from airplane reservation
to hotel management systems was done in order to study the structure and
organization behind such code. We noticed the modularization of specific tasks in
the form of functions, and implemented the same feature in our program to make
the code much more efficient, and to eliminate redundancy.

Identified Serial and Parallel tasks


There will be no parallel tasks. Tasks will be executed in a sequential manner, as
per the discretion pf the user who’s navigating around the menu.
Solution Algorithm
We will attempt to define each of these tasks in the form of functions - This will
make the code cleaner by avoiding redundancy and modularizing the algorithm.
The following are the function definitions designed to solve the problem, along
with relevant comments about the purpose and functionality of each set of code:

1. Function: addbooks()

Comment: 

The function is designed to satisfy the following:

 Creating a String array bk_name to store book name and book id


 Creating a integer variable i as a control variable
 Under a for loop, input book name and id and store it in bookName.
 The loop will execute as long as i<totalBooks (Reason: This is
because the loop needs to stop at the size limit if not it causes an
overflow in memory which will throw an error. The index of an array
begins from 0 and not 1, hence the maximum possible index is
totalBooks-1 - this design was done to offset the off-by-one error.)

 Definition:

1. Start.
2. DECLARE string array bk_name[totalBooks]
3. DECLARE integer i
4. OUTPUT “Add books of choice sequentially:”
5. for (i=0; i<totalBooks; i++)

{ INPUT bk_name[i] }

6. OUTPUT “Books have been added successfully.”


7. End
2. Function: delbooks()

Comment:

Here the administrator is instructed to delete the books of his/her choice


given the book name along with their code numbers where the variables are
declared. As the books have been added earlier, the list of these books are
tracked with the help of function. Then the specified books are deleted based
upon their index number from the array. Once the specified books are
deleted, the position of remaining books in the array changes. This is
achieved by initializing another variable c, which will be used to assign the
value of the string at index c+1  to the string at index c, hence deleting the
element at c+1/desired pos. At last an option is given for the administrator,
whether he/she wants to continue or not with the help of a for/while loop.

Definition:

1. Start
2. DECLARE int pos, c.
3. OUTPUT the entire book list with their corresponding code
(position) numbers.
4. OUTPUT “Enter the code corresponding to the book to be removed.”
5. INPUT pos.
6. If (pos >= totalBooks + 1)

{ OUTPUT “Deletion is not possible.” }

else

{ for(c=pos-1; c<totalBooks-1; c++)

{ bookName[c] = bookName [c+1]

                                     bookCode[c] = bookCode [c+1] }

                                                                                                 }

7. OUTPUT “Deletion completed.”


8. OUTPUT edited book list.

9. Stop

   3. Function: searchbooks()
Comment:

This feature will make book discovery much easier, allowing the end user to
search for books either by their name or by their code.

Definition:

1. Start
2. DECLARE integer i
3. DECLARE string t
4. OUTPUT  "Select your Book from the list below:"
5. for (i=0; i<=totalBooks-1; i++)

{ OUTPUT bookName[i] }

6. INPUT t
7. for (i=0; i<=totalBooks-1; i++)

{ if (bookName[i]==t)

      { OUTPUT “Your book is located at position:”, i+1 }


8. Stop.

4. Function: viewbooks()

Comment:
Using the above function, the user will be able to view the various list of
books available at the library which have been added prior using the
function addbooks and alternatively the user will also be given the choice to
view the various books based on their genre.

Definition:

1. Start
2. DECLARE int x
3. OUTPUT “The available books will be listed below”
4. for (x=0; x<=i-1; x++)

{OUTPUT bookName[x] }

5. Function: editdetails()

Comment:
   The book list is displayed using a for-loop to help the administrator make a
selection. Once the selection is made, another for-loop and an if-statement  is used
to track down the selected book entry and a prompt urges the administrator to enter
the new name for the book. The new title is then assigned to the selected
bookName and the edit is reflected successfully.

Definition:

1. Start
2. DECLARE int i
3. for (i=0; i<totalBooks; i++)

{ OUTPUT bookName[i] }

4. DECLARE string choice, newName


5. OUTPUT “Choose the book name you’d like to edit:”
6. INPUT choice
7. for (i=0; i<totalBooks; i++)

{ if (bookName[i]==choice)

      { OUTPUT “Enter new book name:”

         INPUT newName

         ASSIGN bookName[i] = newName }

                                                                           }

8. OUTPUT “Edit completed successfully.”


9. Stop

You might also like