0% found this document useful (0 votes)
30 views24 pages

C.S 2

The document outlines a Library Management System project submitted by Milind Prasad for the 2024-25 academic year. It details the project's objectives, software and hardware configurations, and includes source code for various functionalities such as adding/removing books and members, and borrowing/returning books. The project aims to automate library operations, improving efficiency and accessibility while providing a user-friendly interface.

Uploaded by

devak k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views24 pages

C.S 2

The document outlines a Library Management System project submitted by Milind Prasad for the 2024-25 academic year. It details the project's objectives, software and hardware configurations, and includes source code for various functionalities such as adding/removing books and members, and borrowing/returning books. The project aims to automate library operations, improving efficiency and accessibility while providing a user-friendly interface.

Uploaded by

devak k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

COMPUTER SCIENCE PROJECT

LIBRARY MANAGEMENT SYSTEM


2024-25

SUBMITTED BY:
MILIND PRASAD
12-A
BHARATIYA VIDYA BHAVAN SCHOOL
PERUMTHIRUTHI, CALICUT-673303
Affiliated to CBSE No: 930910

This is to certify that _______________ of class XII-A


has satisfactorily completed the project prescribed
by the Central Board of Secondary Education for
the SSCE course in the laboratory of this school in
the year 2024-25
Date:

Name of the candidate: Signature of the


Reg. No: teacher in charge:

Signature

Internal Examiner External Examiner Principal


ACKNOWLEDGEMENTS
We are eternally grateful to god almighty for the
successful completion of this project.
We thank our principal, Mrs. Sreeja Unnikrishnan for
providing us with the opportunity to perform and
providing us with all the necessary facilities to do the
same.
We would like to take this opportunity to thank our
teacher Mrs. Praveena C for providing us with a well-
equipped and fully functional Computer Practical
Laboratory and for sustaining our efforts throughout
the making of this project. Her small but relevant
modifications took this project to a whole new level.
Thankyou mam for the constructive guidance.
We would like to thank our family and friends for their
support in this project. Their relevant suggestions
improved this project a lot.

INDEX
SLNO DESCRIPTION PAGE NO

1 PROJECT SYNOPSIS

2 INTODUCTION TO PYTHON

3 MYSQL

4 HARDWARE CONFIGURATION

5 SOFTWARE CONFIGURATION

6 SOURCE CODE

7 OUTPUT

8 BIBLIOGRAPHY

PROJECT SYNOPSIS
Title of the Project
Library Management System
Team Members
Adith k
Deva k
Milind P
Aim
This project allows students to apply their programming knowledge to real-world situations,
demonstrating how these programs can be useful in a variety of contexts.
1. The main objective of the library management is that it manages all the information
about books,members,transactions etc.
2. The purpose of the project is to build an application program to reduce manual effort
in tracking library books and users.
3. Library management saves our time by automate routine tasks such as due date
reminders, overdue fines, and inventory updates.
4. It will provide a modern, efficient solution to managing library resources, improving
accessibility and reducing operational overhead.
Introduction
To design and develop a Library Management System that allows efficient management of
library resources, including book inventory, user records, and borrowing activities, while
providing an easy-to-use interface for both library staff and user .

Software Used:python,MySQL
Modules used:mysql.connector
User Defined Functions
Connect_db()-This function establishes a connection to the MySQL database.
add_book()-This function adds a new book to the library
remove_book()-This function removes a book from the library
view_book()-This function retrieves and displays a list of all books in the books table.
add_member()-This function adds a new member to the library
remove_member()-This function removes a member from the library
list_all_member()-This function retrieves and displays a list of all members in the members
table.
borrow_book()-This function allows a member to borrow a book in the transactions table.
return_book()-This function allows a member to return a borrowed book in the transactions
table.

Reason for choosing the topic


Our group decided to choose this topic that Mimics real-world library operations, making it
a highly applicable project,provides valuable experience in database management,
application development, and system design.It’s a well-rounded project that helps you
develop key skills while addressing a tangible problem.

Future Enhancement
In any project,though present satisfaction is important but also it is equally important to see
and visualize the future scope.This project which is developed now may be need to undergo
some changes in future in order to match up the technology prevailing that time,thus change
due to development in technology are advisable.
Some of the future scope are:-
1.AI can be used for personalized book recommendations, predictive analytics for
inventory management, and voice search for easier navigation.
2.Enhance scalability and facilitate the management of both physical and digital resources in
one platform.

INTRODUCTION TO PYTHON AND FEATURES

What is Python?
Python is an Open source, General Purpose, Object-oriented High-level
programming language. It was Developed By Guido Van Rossum In 1991.
Python programming is a highly interpreted and object-oriented language with
built-in data structures, combined with dynamic typing and dynamic binding,
which makes it very attractive for Rapid Application Development.

What is Python Used For?


Python is the best computer programming language used to build websites and
software, automate tasks, and conduct data analysis. Python is used to create a
variety of different programs and isn’t specialized for any specific problems, as
it is a general-purpose language. Its versatile feature, along with its beginner-
friendliness, makes Python one of the most-used programming languages
today. It is also used for:
o Software Development, AI and machine learning.
o Web Development (server side) and system scripting.
o Data science and data visualization
o Game development and GUI Development
o Scientific and non-scientific programming

Where is Python Used?


Python is used in everything from machine learning to building websites and
software testing. Python language is used for building mobile, web and
desktop applications. Python is also used when testing these applications. It
is used in creating recommendation algorithms, building software that
controls self-driving cars, automates our everyday tasks, from web
development to scripting, software testing, and prototyping.

Advantages Of Python Over Other Programming Languages


 It's Simple, Free and Easy to Use
 It has Lots of Libraries
 It has Built-in Data Structures
 It's Widely Applicable and is Easy to Learn
 It Increases Speed and Productivity

MySQL
MySQL is an open – sourced and freely available relational database
management system (RDBMS) that uses SQL.
MySQL is developed and supported by Sweden based company, MySQL
AB. which is know today as Oracle Corporation.
It provides features for creating, storing maintaining and accessing data,
stored in the form database and their tables.
SQL is used for creation, modification and extraction of data from a
relational database.
Using SQL we can search for any data in the database and perform
functions like creating tables, adding records, modifying data, removing
rows, dropping tables etc…
Features of MySQL
 Easy to use and Flexible
 Client/Server Architecture
 Free to use
 High Productivity
 No coding required.
 Works with different languages
SOFTWARE CONFIGURATION
Operating System:
Edition: Windows 11 home
Version: 21H2
Software Used: Python,MySQL

HARDWARE CONFIGURATION
Processor: 11th Gen Intel(R) Core(TM) i3-1115G4 @ 3.00GHz 3.00 GHz
System Type: 64-bit operating system, x64-based processor
RAM:8.00 GB
Solid state drive(SSD):512GB

SOURCE CODE

import mysql.connector as mc
from datetime import datetime

# MySQL connection setup


def connect_db():
return mc.connect(
host="localhost", # Replace with your MySQL
host
user="root", # Replace with your MySQL
user
password="123", # Replace with your MySQL
password
database="library_management_system"
)

# Add a new book to the library


def add_book(book_id, title, author, quantity):
db = connect_db()
cursor = db.cursor()
cursor.execute("INSERT INTO books (book_id, title,
author, quantity) VALUES (%s, %s, %s, %s)", (book_id,
title, author, quantity))
db.commit()
cursor.close()
db.close()
print("Book added successfully!")

# Remove a book from the library


def remove_book(book_id):
db = connect_db()
cursor = db.cursor()
cursor.execute("DELETE FROM books WHERE
book_id = %s", (book_id,))
db.commit()
cursor.close()
db.close()
print("Book removed successfully!")

# View all books


def view_books():
db = connect_db()
cursor = db.cursor()
cursor.execute("SELECT * FROM books")
books = cursor.fetchall()
for book in books:
print(f"ID: {book[0]}, Title: {book[1]}, Author:
{book[2]}, Quantity: {book[3]}")
cursor.close()
db.close()

# Add a new member to the library


def add_member(member_id, name, email):
db = connect_db()
cursor = db.cursor()
# Manually input member_id
cursor.execute("INSERT INTO members (member_id,
name, email) VALUES (%s, %s, %s)", (member_id,
name, email))
db.commit()
cursor.close()
db.close()
print("Member added successfully!")

#Remove a member from library


def remove_member(member_id):
db = connect_db()
cursor = db.cursor()
cursor.execute("DELETE FROM members WHERE
member_id = %s", (member_id,))
db.commit()
cursor.close()
db.close()
print('Member removed successfully!')

#List all members in library


def list_all_members():
db= connect_db()
cursor = db.cursor()
cursor.execute("SELECT * FROM members")
members = cursor.fetchall()
for member in members:
print(f"ID: {member[0]}, Name: {member[1]},
email: {member[2]}")
cursor.close()
db.close()

# Borrow a book
def borrow_book(book_id, member_id):
db = connect_db()
cursor = db.cursor()

# Check if the book is available


cursor.execute("SELECT quantity FROM books
WHERE book_id = %s", (book_id,))
book = cursor.fetchone()

if book and book[0] > 0:


# Update the book quantity
cursor.execute("UPDATE books SET quantity =
quantity - 1 WHERE book_id = %s", (book_id,))
# Record the transaction with custom transaction_id
transaction_id = int(input("Enter a custom
transaction ID: ")) # Manually input transaction ID
cursor.execute("INSERT INTO transactions
(transaction_id, book_id, member_id, borrow_date)
VALUES (%s, %s, %s, %s)",
(transaction_id, book_id, member_id,
datetime.now().date()))
db.commit()
print("Book borrowed successfully!")
else:
print("Book is not available.")

cursor.close()
db.close()

# Return a book
def return_book(transaction_id):
db = connect_db()
cursor = db.cursor()

# Update the return date of the transaction


cursor.execute("UPDATE transactions SET return_date
= %s WHERE transaction_id = %s",
(datetime.now().date(), transaction_id))

# Update the book quantity


cursor.execute("SELECT book_id FROM transactions
WHERE transaction_id = %s", (transaction_id,))
book_id = cursor.fetchone()[0]
cursor.execute("UPDATE books SET quantity =
quantity + 1 WHERE book_id = %s", (book_id,))

db.commit()
cursor.close()
db.close()
print("Book returned successfully!")

# Main function to interact with the system


def main():
while True:
print("\nLibrary Management System")
print("1. Add Book")
print("2. Remove Book")
print("3. View Books")
print("4. Add Member")
print("5. Remove Member")
print("6. List all Members")
print("7. Borrow Book")
print("8. Return Book")
print("9. Exit")

choice = input("Enter your choice: ")

if choice == '1':
book_id = int(input("Enter book ID: "))
title = input("Enter book title: ")
author = input("Enter book author: ")
quantity = int(input("Enter book quantity: "))
add_book(book_id, title, author, quantity)

elif choice == '2':


book_id = int(input("Enter book ID to remove: "))
remove_book(book_id)

elif choice == '3':


view_books()

elif choice == '4':


member_id = int(input("Enter member ID: "))
name = input("Enter member name: ")
email = input("Enter member email: ")
add_member(member_id, name, email)

elif choice == '5':


member_id = int(input("Enter member ID to
remove: "))
remove_member(member_id)

elif choice == '6':


list_all_members()

elif choice == '7':


book_id = int(input("Enter book ID to borrow: "))
member_id = int(input("Enter member ID: "))
borrow_book(book_id, member_id)

elif choice == '8':


transaction_id = int(input("Enter transaction ID to
return: "))
return_book(transaction_id)

elif choice == '9':


print("Exiting system...")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()

MYSQL TABLE
OUTPUT
To view all books:
Adding book:
Removing book:

To see all members:

To add and remove members:


To borrow and return books:
BIBILOGRAPHY

 https://www.google.com/
 https://www.geeksforgeeks.com/
 computer science textbook class 12 by
Preeti Arora
 NCERT computer science textbook class
12 textbook

You might also like