0% found this document useful (0 votes)
19 views19 pages

Computer Science Project Draft

CLASS 12 COMPUTER SCIENCE PROJECT DRAFT (as per CBSE requirements)
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)
19 views19 pages

Computer Science Project Draft

CLASS 12 COMPUTER SCIENCE PROJECT DRAFT (as per CBSE requirements)
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/ 19

CONTENTS

CONTENTS

S.No Topic Page No.


1. Synopsis 1
2. Sample Code 3
3. Output Screen 10
4. Bibliography 16
SYNOPSIS

1
SYNOPSIS

This Python-based project is designed to manage the various operations of


a bookshop, including inventory management, sales tracking, and staff
details, using MySQL as the backend database. The system allows users to
sign up or log in and offers functionalities to add books, track sales, and
manage staff information. It also keeps a record of books sold and updates
the inventory accordingly. Below is a breakdown of the different modules
in the project:

● Signup/Login Module: Allows users to create an account (signup) or


log into the system with a valid username and password.
● Books Module: Facilitates adding new books, updating book
quantities, and deleting books from the inventory.
● Sales Module: Tracks book sales by recording customer details and
updating the available book stock.
● Inventory Module: Displays the list of available books and their
current stock levels.
● Staff Module: Manages staff details, including adding new staff,
removing staff, and viewing staff records.
● Income Module: Calculates the total income generated from book
sales after the last reset.

This system reduces manual effort and streamlines bookshop operations by


providing an organized, easy-to-use interface.

2
SAMPLE CODE

3
SAMPLE CODE

import mysql.connector

mydb = mysql.connector.connect(
host="localhost", user="root", password="viproad"
)

# CREATING DATABASE AND TABLES


mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE IF NOT EXISTS store")
mycursor.execute("USE store")
mycursor.execute("""
CREATE TABLE IF NOT EXISTS signup (
username VARCHAR(20),
password VARCHAR(20)
)
""")

while True:
print("1: Signup\n2: Login")
ch = int(input("SIGNUP/LOGIN (1,2):"))

# SIGNUP
if ch == 1:
username = input("USERNAME: ")
pw = input("PASSWORD: ")
mycursor.execute("INSERT INTO signup (username, password)
VALUES (%s, %s)", (username, pw))
mydb.commit()
4
# LOGIN
elif ch == 2:
username = input("USERNAME: ")
mycursor.execute("SELECT username FROM signup WHERE
username = %s", (username,))
pot = mycursor.fetchone()

if pot is not None:


print("VALID USERNAME!!!!!!")
pw = input("PASSWORD: ")
mycursor.execute("SELECT password FROM signup WHERE
username = %s AND password = %s", (username, pw))
a = mycursor.fetchone()

if a is not None:
print("++++++++++++++++++++++++\n+++ LOGIN
SUCCESSFUL +++\n++++++++++++++++++++++++")

print("""
=====================================================
=======
+++++++++++++++ WELCOME TO B.S. BOOK STORE ++++++++++
++++++
=====================================================
=======
""")

mycursor.execute("""
CREATE TABLE IF NOT EXISTS Available_Books (
BookName VARCHAR(30) PRIMARY KEY,
Genre VARCHAR(20),
Quantity INT(3),
5
Author VARCHAR(20),
Publication VARCHAR(30),
Price INT(4)
)
""")
mycursor.execute("""
CREATE TABLE IF NOT EXISTS Sell_rec (
CustomerName VARCHAR(20),
PhoneNumber CHAR(10) UNIQUE,
BookName VARCHAR(30),
Quantity INT(100),
Price INT(4),
FOREIGN KEY (BookName) REFERENCES
Available_Books(BookName)
)
""")
mycursor.execute("""
CREATE TABLE IF NOT EXISTS Staff_details (
Name VARCHAR(30),
Gender VARCHAR(10),
Age INT(3),
PhoneNumber CHAR(10) UNIQUE,
Address VARCHAR(40)
)
""")
mydb.commit()

while True:
print("""
1: Add Books
2: Delete Books
3: Search Books
6
4: Staff Details
5: Sell Record
6: Available Books
7: Total Income after the Latest Reset
8: Exit
""")
a = int(input("Enter your choice:"))

# ADD BOOKS
if a == 1:
print("All information prompted is mandatory.")
book = input("Enter Book Name: ")
genre = input("Genre: ")
quantity = int(input("Enter quantity: "))
author = input("Enter author name: ")
publication = input("Enter publication house: ")
price = int(input("Enter the price: "))

mycursor.execute("SELECT * FROM Available_Books


WHERE BookName = %s", (book,))
row = mycursor.fetchone()

if row is not None:


mycursor.execute("UPDATE Available_Books SET
Quantity = Quantity + %s WHERE BookName = %s", (quantity, book))
mydb.commit()
print("++++++++++++++++++++++++++\n++
SUCCESSFULLY ADDED ++\n++++++++++++++++++++++++++")
else:
mycursor.execute("""
INSERT INTO Available_Books (BookName, Genre,
Quantity, Author, Publication, Price)
7
VALUES (%s, %s, %s, %s, %s, %s)
""", (book, genre, quantity, author, publication, price))
mydb.commit()
print("++++++++++++++++++++++++++\n++
SUCCESSFULLY ADDED ++\n++++++++++++++++++++++++++")

# DELETE BOOKS
elif a == 2:
print("AVAILABLE BOOKS...")
mycursor.execute("SELECT * FROM Available_Books")
for x in mycursor:
print(x)

cusname = input("Enter customer name: ")


phno = int(input("Enter phone number: "))
book = input("Enter Book Name: ")
price = int(input("Enter the price: "))
n = int(input("Enter quantity: "))

mycursor.execute("SELECT Quantity FROM


Available_Books WHERE BookName = %s", (book,))
lk = mycursor.fetchone()

if lk and lk[0] < n:


print(f"{n} Books are not available!")
else:
mycursor.execute("INSERT INTO Sell_rec
(CustomerName, PhoneNumber, BookName, Quantity, Price) VALUES
(%s, %s, %s, %s, %s)",
(cusname, phno, book, n, price))
mycursor.execute("UPDATE Available_Books SET
Quantity = Quantity - %s WHERE BookName = %s", (n, book))
8
mydb.commit()
print("++++++++++++++++++++++++++\n++ BOOK
HAS BEEN SOLD ++\n++++++++++++++++++++++++++")
# Other options like SEARCH BOOKS, STAFF DETAILS,
etc. can be implemented similarly.
# EXIT
elif a == 8:
break

else:
print("++++++++++++++++++++++++++\n++ INCORRECT
PASSWORD ++\n++++++++++++++++++++++++++")

else:
print("++++++++++++++++++++++++++\n++ INVALID
USERNAME ++\n++++++++++++++++++++++++++")

else:
break

9
OUTPUT SCREEN

10
OUTPUT SCREEN

1. Initial Screen: Sign Up/Login

➔ If the user selects 1, they will see a prompt for a username and
password.
➔ If the user selects 2, they will be asked to provide their username and
password for login.

2. Signup Successful:

3. Login Succes:

Once logged in, the main menu options will appear.

11
4. Main Menu Screen:

5. Add Books Screen:

6. Delete Books Screen:

12
7. Search Books Screen:
The user will choose the search method from the following options:

If searching by name:

If the book is not available:

8. Staff Details Screen:


This menu will prompt for further actions (New Entry, Remove, or
View Details):

13
If adding a new staff member:

If removing staff:

9. Sell Record Screen:

For Sell History:

For resetting history:

14

Available Books Screen:


Total Income After Latest Resort:

10. Exit Screen:


When the user selects Exit:

11. Error Scenarios:


Invalid Username:

Incorrect Password:

Summary:
● After login, the system displays a menu where users can manage
books, staff, sell records, and reports.
● User-friendly prompts are shown for each operation.
● Success messages are displayed after each successful operation, while
invalid inputs result in error messages.

15
BIBLIOGRAPHY

16
BIBLIOGRAPHY
Internet:
www.google.com
www.slideshare.net

Books:
COMPUTER SCIENCE CLASS 12 Book (SUMITA ARORA).

17

Powered by TCPDF (www.tcpdf.org)

You might also like