Library Management System Project 1
Library Management System Project 1
Library Management System Project 1
System Project
Creating a Library Management System (LMS) as a project for your Class 12
Computer Science is a great idea! Here’s a step-by-step guide to help you
structure and develop your project.
Project Planning
Return Books
Implement a feature for returning books, updating transaction records, and calculating
overdue fees.
Implementation
Here's a simplified version of what your Python code could look like using Tkinter for the GUI and SQLite for
the database.
import sqlite3
def setup_database():
conn = sqlite3.connect('library.db')
cursor = conn.cursor()
setup_database()
import tkinter as tk
from tkinter import messagebox
import sqlite3
from datetime import datetime
def add_book():
conn = sqlite3.connect('library.db')
cursor = conn.cursor()
cursor.execute("INSERT INTO books (title, author, publisher, year, copies) VALUES (?, ?, ?, ?, ?)",
(title_entry.get(), author_entry.get(), publisher_entry.get(), year_entry.get(), copies_entry.get()))
conn.commit()
conn.close()
messagebox.showinfo("Success", "Book added successfully")
def issue_book():
conn = sqlite3.connect('library.db')
cursor = conn.cursor()
cursor.execute("INSERT INTO transactions (user_id, book_id, issue_date, status) VALUES (?, ?, ?,
?)", (user_id_entry.get(), book_id_entry.get(), datetime.now().strftime("%Y-%m-%d"), "Issued"))
cursor.execute("UPDATE books SET copies = copies - 1 WHERE book_id = ?",
(book_id_entry.get(),))
conn.commit()
conn.close()
messagebox.showinfo("Success", "Book issued successfully")
def return_book():
conn = sqlite3.connect('library.db')
cursor = conn.cursor()
cursor.execute("UPDATE transactions SET return_date = ?, status = ? WHERE transaction_id = ?",
(datetime.now().strftime("%Y-%m-%d"), "Returned", transaction_id_entry.get()))
cursor.execute("UPDATE books SET copies = copies + 1 WHERE book_id = ?",
(book_id_entry.get(),))
conn.commit()
conn.close()
messagebox.showinfo("Success", "Book returned successfully")
# Tkinter UI setup
root = tk.Tk()
root.title("Library Management System")
# Add Book
# Issue Book
# Return Book
root.mainloop()
Testing
1 Unit Testing
Test each function individually to ensure it works as expected.
2 Integration Testing
Test how different parts of the system interact with each other.
3 System Testing
Test the entire system to ensure it meets all requirements.
Documentation and Presentation