Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Csproject

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

TABLE OF CONTENTS

S.NO CONTENT
1. Introduction
2. Imported files and modules used
3. ENTITY RELATIONSHIP DIAGRAM
4. SYSTEM DEVELOPMENT LIFE
CYCLE
5. CODING
6. OUTPUT SCREENS
7. LIMITATIONS AND FUTURE
ENHANCEMENTS
8. Hardware requirments
9. BIBLIOGRAPHY
INTRODUCTION:-
Library Management System

This Python program is designed to facilitate the management of a


library's book database. The system provides a menu-driven
interface, allowing users to perform various actions such as viewing,
updating, and adding information to the library's book records.

Key Features:
1. Displaying information: Users can view details about books in the
library, including serial numbers and specific column values.
2. Updating data: Users can modify existing information in the
database by selecting a book based on its serial number and
providing new values for specified columns.
3. Borrowers information: The system includes functionality to
manage information related to book borrowers.
4. System closure: Users have the option to close the system when
they have completed their tasks.

This code snippet handles a part of the program's logic, including


user input, database queries, and conditional branching based on
user decisions. It is part of a larger menu-driven system for efficient
library management.
Modules used in the completion of program:-
1. mysql.connector:
• connect():- This function commands the connection
of python and MySQL server to be made.
• cursor():- This function enables a cursor pointer in
the command line client of the MySQL server
• execute():- This function is used to execute the
query which is given as its parameter, this query is
executed in MySQL server.
• fetchall():- This function with already a cursor
present fetches all the result of the query present in
the command line of MySQL .
• commit():- This function lets a user permanently
save all the changes made in the transaction of a
database or table.
Entry Relationship Diagram:-
SYSTEM DEVELOPMENT CYCLE:
The system development cycle, also known as the software
development life cycle (SDLC), is a series of phases that guide
the development of a software application from its initial
concept to its deployment and maintenance. Here's a simplified
version of the SDLC for the library management system you've
implemented:

1. Requirement Analysis:
Define the requirements of the library management system by
consulting with stakeholders, such as librarians and users.
Identify the key features, user roles, and system functionalities
needed.
2. System Design:
Design the architecture of the system, including the database
schema, user interfaces, and overall system structure.
Plan for security measures, user authentication, and
authorization mechanisms.
3. Database Design:
Define the database structure, including tables, relationships,
and constraints.
Choose appropriate data types for each field and establish
primary and foreign key relationships.
4. Implementation (Coding):
Write the code for the library management system based on the
design specifications.
Implement security measures, error handling, and input
validation to enhance robustness.
5. Testing:
Conduct unit testing to verify the functionality of individual
components.
Perform integration testing to ensure that different modules
work together seamlessly.
Test the system with realistic scenarios to identify and fix bugs.
6. Deployment:
Deploy the library management system to a production
environment.
Set up the necessary infrastructure, including the MySQL
database and any server requirements.
7. User Training:
Provide training to users (librarians, administrators, etc.) on
how to use the system effectively.
Create user documentation for reference.
8. Maintenance and Support:
Monitor the system for any issues and provide ongoing
maintenance and support.
Address user feedback and make necessary updates to
improve the system.
9. Enhancements and Iterations:
Based on user feedback and changing requirements, plan for
system enhancements and new features.
Iterate through the development cycle for each new release.
10. Documentation:
Maintain comprehensive documentation for the system,
including design documents, code documentation, and user
manuals.
11. Security Audits:
Periodically conduct security audits to identify and address
potential vulnerabilities.
Stay informed about security best practices and implement
updates accordingly.
12. Backup and Recovery Planning:
Establish a regular backup strategy for the database and
implement mechanisms for data recovery in case of
emergencies.
13. Performance Optimization:
Monitor system performance and optimize as needed,
especially if there are scalability challenges.
Coding: -
import mysql.connector

# Connect to MySQL database


db = mysql.connector.connect(
host="your_host",
user="your_username",
password="your_password",
database="library_management"
)

# Create a cursor object to interact with the database


cursor = db.cursor()

# Create a table to store books


cursor.execute("""
CREATE TABLE IF NOT EXISTS books (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
author VARCHAR(255) NOT NULL,
quantity INT NOT NULL
)
""")
db.commit()

def add_book(title, author, quantity):


# Add a new book to the library
cursor.execute("INSERT INTO books (title, author, quantity) VALUES (%s, %s,
%s)", (title, author, quantity))
db.commit()

def display_books():
# Display all books in the library
cursor.execute("SELECT * FROM books")
books = cursor.fetchall()
if not books:
print("No books in the library.")
else:
print("ID | Title | Author | Quantity")
print("---------------------------------------------------------------")
for book in books:
print(f"{book[0]:<4}| {book[1]:<25}| {book[2]:<25}| {book[3]:<8}")

def search_book(title):
# Search for a book by title
cursor.execute("SELECT * FROM books WHERE title LIKE %s", ('%' + title + '%',))
books = cursor.fetchall()
if not books:
print("Book not found.")
else:
print("ID | Title | Author | Quantity")
print("---------------------------------------------------------------")
for book in books:
print(f"{book[0]:<4}| {book[1]:<25}| {book[2]:<25}| {book[3]:<8}")

def main():
while True:
print("\nLibrary Management System")
print("1. Add Book")
print("2. Display Books")
print("3. Search Book")
print("4. Quit")

choice = input("Enter your choice (1-4): ")

if choice == "1":
title = input("Enter the title of the book: ")
author = input("Enter the author of the book: ")
quantity = int(input("Enter the quantity of the book: "))
add_book(title, author, quantity)
print("Book added successfully.")

elif choice == "2":


display_books()

elif choice == "3":


title = input("Enter the title of the book to search: ")
search_book(title)

elif choice == "4":


print("Exiting the program.")
break

else:
print("Invalid choice. Please enter a number between 1 and 4.")

if __name__ == "__main__":
main()
Output Screenshot:
Main Menu

Option 1 for the output

Option 2 for the output


Option 3 for the output

Option 4 for the output


LIMITATIONS OF THE FOLLOWING CODE:-
• Security Concerns
• No user authentication
• Error Handling
• Scalability
• No GUI

Future Enhancements :-
• User management
• Search and Filtering
• Transaction management
• Logging
• Notification System
• Web interface
• Cloud Integration
• Data Validation
HARDWARE AND SOFTWARE
REQUIREMENTS
Hardware Requirements:
• Processor - Intel® Atom™ CPU Z3735F @ 1.33 GHz
• RAM - 2.00 GB
• Keyboard
• Mouse

Software Requirements:
• Windows 10
• OS.build - 15063.1418 32 bit
• Python IDLE
• MySQL
1. www.slideshare.net
2. www.geeksforgeeks.org
3. www.google.com
4. Computer Science with Python
by Sumita Arora Class XIIth(Book

You might also like