Sample CS - PROJECT (2025)
Sample CS - PROJECT (2025)
ON THE TITLE
FOR
SUBMITTED BY:
________________________________
System is submitted in partial fulfillment of CBSE’s AISSCE Examination 2024-25 and has
been carried out by me under the guidance and supervision of Ms. M Lavanya.
2
ACKNOWLEDGMENT
At the outset, I bow down before the God Almighty for his blessings without which I
would not have completed this endeavor successfully.
______________________________________
3
CONTENTS
Abstract 5
Objectives 6
Coding 8
Screen shots 35
Limitations 43
Conclusion 44
Bibliography 45
4
ABSTRACT
Library management system is all about organizing, managing the library and
library-oriented tasks. It also involves maintaining the database of entering new
books and the record of books that have been retrieved or issued, with their
respective dates. This Project provides an easily handled and automated library
management system. This project also provides features and interface for
maintaining librarian’s records, student’s history of issue. The librarian can
easily update the data by deleting and inserting data in the database with this
project.
5
OBJECTIVE
1. Books Management
2. Student Management
3. Issue Book
4. Return Book
5. Search Books
6. Get Report
7. Report Lost, Stolen and Weeded-out Books
8. Librarian Management
This project also simplifies the task and reduces the amount of paperwork. This
project is user friendly and it is anticipated that the functions of the management
system are easily accessed by the user. This project helps the librarian too keep
track of library resources:
6
SYSTEM REQUIREMENTS AND SPECIFICATIONS
HARDWARE COMPONENTS
1. VGA Monitor
2. Qwerty keyboard
3. 2 GB RAM
4. 2.6 GHz Processor
5. Graphics card
SOFTWARE COMPONENTS
1. Windows 7 or above
2. Python 3.7 with suitable modules
3. MySQL Command Client
7
CODING
8
This menu is used to add data about stolen books,lost books or weed out
books to
keep the status of all the books updated.
10. Librarian Management("admin only")
This menu is customized so only particular people who knows the
master password which is ‘adminlib’
can use this menu and this menu is used to control the data of librarian’s
working in
library.
'''
# --------------------Library imports
import mysql.connector
from datetime import date
from prettytable import from_db_cursor
# --------------------Global declarations
fine_per_day =1.0
# --------------------Global functions
def add_book():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
title = input('Enter Book Title :')
author = input('Enter Book Author : ')
publisher = input('Enter Book Publisher : ')
pages = input('Enter Book Pages : ')
price = input('Enter Book Price : ')
edition = input('Enter Book Edition : ')
copies = int(input('Enter copies : '))
sql = 'insert into book(title,author,price,pages,publisher,edition,status) values (
"' + \
9
title + '","' +
author+'",'+price+','+pages+',"'+publisher+'","'+edition+'","available");'
10
print('Modify BOOK Details Screen ')
print('-'*120)
print('\n1. Book Title')
print('\n2. Book Author')
print('\n3. Book Publisher')
print('\n4. Book Pages')
print('\n5. Book Price')
print('\n6. Book Edition')
print('\n\n')
choice = int(input('Enter your choice :'))
field = ''
if choice == 1:
field = 'title'
if choice == 2:
field = 'author'
if choice == 3:
field = 'publisher'
if choice == 4:
field = 'pages'
if choice == 5:
field = 'price'
book_id = input('Enter Book ID :')
value = input('Enter new value :')
if field =='pages' or field == 'price':
sql = 'update book set ' + field + ' = '+value+' where b_id = '+book_id+';'
else:
sql = 'update book set ' + field + ' = "'+value+'" where b_id = '+book_id+';'
cursor.execute(sql)
11
print('\n\n\nBook details Updated.....')
conn.close()
wait = input('\n\n\n Press any key to continue....')
def modify_member():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('Modify Member Information Screen ')
print('-'*120)
print('\n1. Name')
print('\n2. Class')
print('\n3. address')
print('\n4. Phone')
print('\n5. Email')
print('\n\n')
choice = int(input('Enter your choice :'))
field =''
if choice == 1:
field ='name'
if choice == 2:
field = 'class'
if choice ==3:
field ='address'
if choice == 4:
field = 'phone'
if choice == 5:
field = 'email'
mem_id =input('Enter member ID :')
12
value = input('Enter new value :')
sql = 'update member set '+ field +' = "'+value+'" where m_id = '+mem_id+';'
#print(sql)
cursor.execute(sql)
print('Member details Updated.....')
conn.close()
wait = input('\n\n\n Press any key to continue....')
def mem_issue_status(mem_id):
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
sql ='select * from transaction where m_id ='+mem_id +' and dor is NULL;'
cursor.execute(sql)
results = cursor.fetchall()
return results
def book_status(book_id)
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
sql = 'select * from book where b_id ='+book_id + ';'
cursor.execute(sql)
result = cursor.fetchone()
return result[5]
def book_issue_status(book_id,mem_id):
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
sql = 'select * from transaction where b_id ='+book_id + ' and m_id ='+
mem_id +' and dor is NULL;'
13
cursor.execute(sql)
result = cursor.fetchone()
return result
def issue_book():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n BOOK ISSUE SCREEN ')
print('-'*120)
book_id = input('Enter Book ID : ')
mem_id = input('Enter Member ID :')
result = book_status(book_id)
result1 = mem_issue_status(mem_id)
#print(result1)
today = date.today()
if len(result1) == 0:
if result == 'available':
sql = 'insert into transaction(b_id, m_id, doi)
values('+book_id+','+mem_id+',"'+str(today)+'");'
sql_book = 'update book set status="issue" where b_id ='+book_id + ';'
cursor.execute(sql)
cursor.execute(sql_book)
print('\n\n\n Book issued successfully')
else:
print('\n\nBook is not available for ISSUE... Current status :',result1)
else:
if len(result1)<1:
sql = 'insert into transaction(b_id, m_id, doi) values(' + \
book_id+','+mem_id+',"'+str(today)+'");'
14
sql_book = 'update book set status="issue" where b_id ='+book_id + ';'
#print(len(result))
cursor.execute(sql)
cursor.execute(sql_book)
print('\n\n\n Book issued successfully')
else:
print('\n\nMember already have book from the Library')
#print(result)
conn.close()
wait = input('\n\n\n Press any key to continue....')
def return_book():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
global fine_per_day
print('\n BOOK RETURN SCREEN ')
print('-'*120)
book_id = input('Enter Book ID : ')
mem_id = input('Enter Member ID :')
today = date.today()
result = book_issue_status(book_id,mem_id)
if result==None:
print('Book was not issued...Check Book Id and Member ID again..')
else:
sql='update book set status ="available" where b_id ='+book_id +';'
din = (today - result[3]).days
if(din>=30):
fine = din * fine_per_day
15
fx=fine - 30 # fine per data
sql1 = 'update transaction set dor ="'+str(today)+'" , fine='+str(fx)+'
where b_id='+book_id +' and m_id='+mem_id+' and dor is NULL;'
cursor.execute(sql)
cursor.execute(sql1)
print('\n\nBook returned successfully')
conn.close()
wait = input('\n\n\n Press any key to continue....')
else:
fine = 0 * fine_per_day # fine per data
sql1 = 'update transaction set dor ="'+str(today)+'" , fine='+str(fine)+'
where b_id='+book_id +' and m_id='+mem_id+' and dor is NULL;'
cursor.execute(sql)
cursor.execute(sql1)
print('\n\nBook returned successfully')
conn.close()
wait = input('\n\n\n Press any key to continue....')
def search_book(field):
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n BOOK SEARCH SCREEN ')
print('-'*120)
msg ='Enter '+ field +' Value :'
title = input(msg)
sql ='select * from book where '+ field + ' like "%'+ title+'%"'
cursor.execute(sql)
print('Search Result for :',field,' :' ,title)
print('-'*120)
16
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\n Press any key to continue....')
def search_menu():
while True:
print(' S E A R C H M E N U ')
print("\n1. Book Title")
print('\n2. Book Author')
print('\n3. Publisher')
print('\n4. Exit to main Menu')
print('\n\n')
choice = int(input('Enter your choice ...: '))
field =''
if choice == 1:
field='title'
if choice == 2:
field = 'author'
if choice == 3:
field = 'publisher'
if choice == 4:
break
search_book(field)
def reprot_book_list():
conn = mysql.connector.connect( host='localhost', database='library',
user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - BOOK TITLES ')
print('-'*120)
17
sql ='select * from book'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_issued_books():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - BOOK TITLES - Issued')
print('-'*120)
sql = 'select * from book where status = "issue";'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_available_books():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - BOOK TITLES - Available')
print('-'*120)
sql = 'select * from book where status = "available";'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
18
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_weed_out_books():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - BOOK TITLES - Weed Out')
print('-'*120)
sql = 'select * from book where status = "weed-out";'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_stolen_books():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - BOOK TITLES - Stolen')
print('-'*120)
sql = 'select * from book where status = "stolen";'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_lost_books():
conn = mysql.connector.connect(
19
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - BOOK TITLES - lost')
print('-'*120)
sql = 'select * from book where status = "lost";'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_member_list():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - Members List ')
print('-'*120)
sql = 'select * from member'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_fine_collection():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
sql ='select sum(fine) from transaction where dor ="'+str(date.today())+'";'
cursor.execute(sql)
20
result = cursor.fetchone() #always return values in the form of tuple
print('Fine collection')
print('-'*120)
print('Total fine collected Today :',result[0])
print('\n\n\n')
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def report_menu():
while True:
print(' R E P O R T M E N U ')
print("\n1. Book List")
print('\n2. Member List')
print('\n3. Issued Books')
print('\n4. Available Books')
print('\n5. Weed out Book')
print('\n6. Stolen Book')
print('\n7. Lost Book')
print('\n8. Fine Collection')
print('\n9. Exit to main Menu')
print('\n\n')
choice = int(input('Enter your choice ...: '))
if choice == 1:
reprot_book_list()
if choice == 2:
report_member_list()
if choice == 3:
report_issued_books()
21
if choice == 4:
report_available_books()
if choice == 5:
report_weed_out_books()
if choice == 6:
report_stolen_books()
if choice == 7:
report_lost_books()
if choice == 8:
report_fine_collection()
if choice == 9:
break
def change_book_status(status,book_id):
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
sql = 'update book set status = "'+status +'" where b_id ='+book_id + ' and
status ="available"'
cursor.execute(sql)
print('Book status changed to ',status)
print('\n\n\n')
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def special_menu():
while True:
print(' S P E C I A L M E N U')
print("\n1. Book Stolen")
print('\n2. Book Lost')
print('\n3. Book Weed out')
22
print('\n4. Exit to Main Menu')
print('\n\n')
choice = int(input('Enter your choice ...: '))
status=''
if choice == 1:
status ='stolen'
if choice == 2:
status = 'lost'
if choice == 3:
status = 'weed-out'
if choice == 4:
break
book_id = input('Enter book id :')
change_book_status(status,book_id)
def librarian():
while True
x=input("Enter Master Password to continue or \nPress any Key to go back
:")
y="adminlib"
if(x==y):
print(' L I B R A R I A N M E N U')
print("\n1. Add Librarian")
print('\n2. Modify Librarian Details and Salary')
print('\n3. Librarian List')
print('\n4. Delete Librarian')
print('\n0. Exit to Main Menu')
print('\n\n')
choice = int(input('Enter your choice ...: ')
if choice == 1:
23
add_librarian()
if choice == 2:
modify_librarian()
if choice == 3:
list_librarians()
if choice == 4:
del_librarian()
if choice == 0:
break
else:
break
def add_librarian():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
name = input('Enter Librarian Name :')
sal = input('Enter Librarian Salary : ')
address = input('Enter Librarian Address : ')
phone = input('Enter Librarian Phone : ')
email = input('Enter Librarian Email : ')
sql = 'insert into librarian(name,salary,address,phone,email) values ( "' + \
name + '","' + sal+'","'+address+'","'+phone + \
'","'+email+'");'
cursor.execute(sql)
conn.close()
print('\n\nNew Librarian added successfully')
wait = input('\n\n\n Press any key to continue....')
def modify_librarian():
24
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('Modify Librarian Information Screen ')
print('-'*120)
print('\n1. Name')
print('\n2. Salary')
print('\n3. address')
print('\n4. Phone')
print('\n5. Email')
print('\n\n')
choice = int(input('Enter your choice :'))
field =''
if choice == 1:
field ='name'
if choice == 2:
field = 'salary'
if choice ==3:
field ='address'
if choice == 4:
field = 'phone'
if choice == 5:
field = 'email'
l_id =input('Enter member ID :')
value = input('Enter new value :')
sql = 'update librarian set '+ field +' = "'+value+'" where l_id = '+l_id+';'
#print(sql)
cursor.execute(sql)
25
print('Librarian details Updated.....')
conn.close()
wait = input('\n\n\n Press any key to continue....')
def del_librarian():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
l_id = input('Enter Librarian ID :')
'DELETE FROM librarian WHERE l_id = '+l_id+';'
sql = 'delete from librarian where l_id = '+l_id+';
cursor.execute(sql)
conn.close()
print('\n\n5 Librarian deleted successfully')
wait = input('\n\n\n Press any key to continue....')
def list_librarians():
conn = mysql.connector.connect(
host='localhost', database='library', user='admin', password='mysql')
cursor = conn.cursor()
print('\n REPORT - Librarians ')
print('-'*120)
sql = 'select * from librarian;'
cursor.execute(sql)
x = from_db_cursor(cursor)
print(x)
conn.close()
wait = input('\n\n\nPress any key to continue.....')
def main_menu():
while True:
26
print(' L I B R A R Y M E N U')
print("\n1. Add Books")
print('\n2. Add Member')
print('\n3. Modify Book Information')
print('\n4. Modify Student Information')
print('\n5. Issue Book')
print('\n6. Return Book')
print('\n7. Search Menu')
print('\n8. Report Menu')
print('\n9. Special Menu')
print('\n10. Librarian Management("admin only")')
print('\n0. Close application')
print('\n\n')
choice = int(input('Enter your choice ...: ')
if choice == 1:
add_book()
if choice == 2:
add_member()
if choice == 3:
modify_book()
if choice == 4:
modify_member()
if choice == 5:
issue_book()
if choice == 6:
return_book()
if choice == 7:
search_menu()
27
if choice == 8:
report_menu()
if choice == 9:
special_menu()
if choice == 10:
librarian()
if choice == 0:
break
# --------------------Callable functions ------------------------
if __name__ == "__main__":
main_menu()
28
BACK END CODING (MySQL)
USE library;
29
INSERT INTO `book` VALUES (1,'Let us Python','yashwant
kanetkar',879,150.00,'available','bpb','10'),(2,'Robin Hood','rakesh
kumar',350,250.00,'available','Deewan international','1'),(3,'Connect
Dots','rashmi bansal',256,200.00,'issue','penguin india','1'),(4,'Connect
Dots','rashmi bansal',256,200.00,'issue','penguin india','1'),(5,'Connect
Dots','rashmi bansal',256,200.00,'available','penguin india','1'),(6,'Connect
Dots','rashmi bansal',256,200.00,'issue','penguin india','1'),(7,'Connect
Dots','rashmi bansal',256,200.00,'stolen','penguin india','1'),(8,'Diary of the
man','Mario Brothers',565,450.00,'available','BPB','2'),(9,'Diary of the
man','Mario Brothers',565,450.00,'available','BPB','2'),(10,'Diary of the
man','Mario Brothers',565,450.00,'weed-out','BPB','2'),(11,'Story of Man
Kind','Tom Ayuth',345,450.00,'available','Tata McGraw Hill','2'),(12,'Story of
Man Kind','Tom Ayuth',345,450.00,'available','Tata McGraw Hill','2'),(13,'Story
of Man Kind','Tom Ayuth',345,450.00,'issue','Tata McGraw Hill','2'),(14,'The
lean startup','Peter thiel',345,190.00,'lost','penguin india','2'),(15,'The lean
startup','Peter thiel',345,190.00,'available','penguin india','2'),(16,'The lean
startup','Peter thiel',345,190.00,'available','penguin india','2'),(17,'The lean
startup','Peter thiel',345,190.00,'available','penguin india','2'),(18,'The lean
startup','Peter thiel',345,190.00,'available','penguin india','2'),(19,'The life of
ram','mani',445,650.00,'available','Mani Publications','2'),(20,'The
Tyranny','Popo',55,200.00,'available','penguin india','2'),(21,'Love of
war','lithya',255,250.00,'available','penguin india','3'),(22,'Love of
war','lithya',255,250.00,'available','penguin india','3');
30
-- Dumping data for table `librarian`
--
31
INSERT INTO `member` VALUES (1,'ram lal','12 A','cf-4 brij
vihar','987177171','[email protected]'),(2,'samriddhi','4 B','f-124 surya
nagar','2345677890','[email protected]'),(3,'kamal aggarwal','10 A','cf-9 brij
vihar','987383843','[email protected]'),(4,'rakshit','10 A','f-32 surya
nagar','65775575','[email protected]'),(5,'akash','8 D','a-32 lay
nagar','51486465','[email protected]'),(6,'prasanna','9 C','k-52 lay
nagar','64868165','[email protected]'),(7,'murthi','9 D','E-54 kumar
nagar','66186816','[email protected]'),(8,'rahul','10 A','E-84 mana
nagam','98415615','[email protected]'),(9,'mani','10 C','A-33 adda
manam','56665615','[email protected]'),(10,'praveen','11 C','K-93 adda
manam','6615615','[email protected]'),(11,'sundar','11 A','rm-4 brinja
nagar','58468445','[email protected]');
32
30',NULL,NULL),(6,2,9,'2021-01-06','2020-12-06',0.00),(7,8,8,'2021-02-
02',NULL,NULL),(8,9,4,'2021-02-06',NULL,NULL);
--Completed
33
SCREENSHOTS
PYTHON SCREENSHOTS
Main Menu
Add Book
34
Add Member
35
Modify Member Detail
Issue Book
36
Return Book
Search Menu
Report Menu
37
Book Report
38
Available Book Report
Special Menu
39
SQL SCREENSHOTS
40
Member table description
41
LIMITATIONS
42
CONCLUSION
43
BIBLIOGRAPHY
2. Internet reference :
i) https://www.w2schools.com/
ii) http://geeksforgeeks.org/
iii) http://realpython.com
44