0% found this document useful (0 votes)
35 views29 pages

CS Project Mobile Management

The document outlines a Computer Science project on Smartphone Dealership completed by Ishaan Gupta and Kshitiz Aggarwal under the guidance of Ms. Parul Sharma. It describes the project's background, functions, modules, technology used, hardware and software requirements, and includes Python code for database connectivity and user interfaces. The project aims to streamline smartphone dealership operations by digitizing customer management and inventory tracking.

Uploaded by

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

CS Project Mobile Management

The document outlines a Computer Science project on Smartphone Dealership completed by Ishaan Gupta and Kshitiz Aggarwal under the guidance of Ms. Parul Sharma. It describes the project's background, functions, modules, technology used, hardware and software requirements, and includes Python code for database connectivity and user interfaces. The project aims to streamline smartphone dealership operations by digitizing customer management and inventory tracking.

Uploaded by

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

Computer science

project
Smartphone dealership

Session: 2024-25

Submitted by: Submitted To:


Ishaan Gupta Ms. Parul
Sharma
Certificate
Kshitiz Aggarwal
Ishan
Class: XII-A
Page | 1
This is to certify that Ishaan Gupta, Kshitiz
Aggarwal of class XII-A of Brain International
School have successfully completed the Computer
Science project on the topic Smartphone
Dealership under the guidance of Ms. Parul
Sharma during the academic year 2024-25.

Internal Examiner External Examiner

Principal

Page | 2
Acknowledgemen
t

I would like to express my special thanks of gratitude to


my teacher, Ms. Parul Sharma who taught and
undertook the responsibility of teaching the subject
computer science. I am especially indebted to our
Principal Ms. Mamta Gupta who has always been a
source of encouragement and support and without
their help, guidance and support it would be
impossible to complete this project.
Secondly, I would also like to thank my parents and
friends who helped me a lot in finishing this project
within limited time. I am making this project not only
for marks but also to increase my knowledge.
Once again thanks to all who helped me in doing this
project.

Page | 3
Index
Sr. No. Content Page No.

1. Certificate 2

2. Acknowledgement 3

3. Background of Project 5

3. Functions and Modules 6

4. Flow of Project 9

5. Use of technology 12

6. Hardware and Software 16


requirements
7. Coding 17

8. Output interface 28

Page | 4
9. Bibliography 31

BACKGROUND
OF THE PROJECT
In today’s tech-driven world, smartphones have
become an essential part of our lives. However,
managing the sale and service of smartphones
often involves extensive manual effort, from
maintaining customer records to processing
transactions.
This software simplifies the operations of a
smartphone dealership by digitizing key
processes. It registers customer details such as
name, contact information, and purchase history,
and tracks inventory, including brand, model, and
availability. Customers can easily browse and book
smartphones, schedule service appointments, and
access warranty details.
By streamlining these processes, the software
enhances customer satisfaction and improves

Page | 5
dealership management efficiency, making it a
valuable tool for both businesses and their clients.

FUNCTIONS AND
MODULES
Modules:

import mysql.connecter:
By importing this package, we are able to
establish the connection between SQL and
Python.

Functions:

connect_to_db(password):
This function establishes connection between
Python and MySQL.
search_products(cursor, company, product_name):

Page | 6
Performs the task of searching for products in a
company specified by the user.
dealer_menu():
Serves the dealer menu functionality. Displays a
the records that provide internal details related to
the retailer.
customer_menu():
Serves the customer menu functionality. Helps the
user to shop from the store efficiently by
displaying the essential records.

fetchall():
This function will return all the rows from the
result set in the form of a tuple containing the
records.
commit():
This function provides changes in the database
physically.

Page | 7
cursor():
It is a special control structure that facilitates the row-
by-row processing of records in the result set.

FLOW OF THE
PROJECT
The basic fundamentals of this project are-
1. Database Connectivity:
- The code uses “mysql.connector” to establish a
connection to the database.
- “connect_to_db” manages the database
connection.

2. Product Search:
- The “search_products” function allows
querying products by company and product name.

3. Dealer Menu:

Page | 8
- The “dealer_menu” function provides options
like "STOCK" and "SALES", which are likely linked
to stock management and sales functionalities.
The functioning of the program follows-

1. Initialization
- User inputs the database password.
- Connection to the “drift” database is
established.

2. Dealer Menu
- Options for managing:
- Stock: Adding or updating products.
- Sales: Viewing or processing sales records

3. Product Management
- Search Products:
- Query products by company and product
name.

Page | 9
- Retrieve and display product details (name,
price, stock).
- Update Stock:
- Add new products or restock existing ones.

4. Sales Management
- Record new sales.
- View detailed sales history (filtered by date or
product).

5. Error Handling
- Proper handling of database connection or
query errors.

6. Termination
- Close the database connection and exit the
application gracefully.

Page | 10
Use of
Technology

MySQL is a relational DBMS that can run


virtually all platforms, including Linux, Unix
and Windows. Popular for web-based
applications and online publishing, MySQL is a
part of open-source enterprise stack LAMP
(Linux, Apache, MySQL, PHP).
MySQL is a freely available open source
RDBMS(relational database management
system) that uses Structured Query Language
(SQL). It is down-loadable from
https://www.mysql.com/. It is fast, reliable,

Page | 11
scalable alternative to many of the
commercial RDBMS’ available today.
The software provides you with a rich set of
features that support a secure environment
for storing, maintaining, and accessing data.
MySQL was created and supported by MySQL
AB, a company based in Sweden. This
company is now a subsidiary of Sun
Microsystems, which holds the copyright to
most of the codebase. On April 20th, 2009,
Oracle Corp., which develops and sells the
proprietary Oracle database, announced a
deal to acquire Sun Microsystems. SQL
provides many different types of commands
used for different purposes. SQL commands
can be divided into following categories:
i. Data Definition Language (DDL)
ii. Data Manipulation Language (DML)
iii. Transaction Control Language (TCL)
iv. Session Control Commands
v. System Control Commands

Page | 12
Python is an interpreted, object-oriented,
high-level programming language with
dynamic semantics. Its high-level built in
data structures, combined with dynamic
typing and dynamic binding; make it very
attractive for Rapid Application
Development, as well as for use as a
scripting or glue language to connect
existing components together.
Python's simple, easy to learn syntax
emphasizes readability and therefore
reduces the cost of program maintenance. It
supports modules and packages, which
encourages program modularity and code
reuse.

Page | 13
The Python interpreter and the extensive
standard library are available in source or
binary form without charge for all major
platforms, and can be freely distributed.
Often, programmers fall in love with Python
because of the increased productivity it
provides. Debugging Python programs is
easy: a bug or bad input will never cause a
segmentation fault. Instead, when the
interpreter discovers an error, it raises an
exception. A source level debugger allows
inspection of local and global variables,
evaluation of arbitrary expressions, setting
breakpoints, stepping through the code a
line at a time, and so on. The debugger is
written in Python itself, testifying to
Python's introspective power. On the other
hand, often the quickest way to debug a
program is to add a few print statements to
the source: the fast edit-test-debug cycle
makes this simple approach very effective.

Page | 14
HARDWARE AND
SOFTWARE
REQUIREMENTS
SYSTEM:
OS- Windows 7 Professional 32-Bit or more
Processor- Dual-core processor (2.0 GHz or
higher)
Memory- 2 GB or more
DirectX Version- DirectX12
Storage- 10GB of available disk space
Display adapter- Intel® HD Graphics
SOFTWARE:
Python 3.12 64-bit or
MySQL
MySQL-connector-python

Page | 15
PYTHON
CODES

Page | 16
import mysql.connector

# Global variables
add = []
buy = []
def connect_to_db(password):
"""Establish a connection to the database."""
try:
return mysql.connector.connect(
host="localhost",
database="drift",
user="root",
password=password
)
except mysql.connector.Error as e:
print("Error connecting to the database:", e)
return None

def search_products(cursor, company, product_name):


"""Search for products in a specified company."""
query = f"SELECT pname, price, stock FROM {company} WHERE
pname = %s"
try:
cursor.execute(query, (product_name,))
return cursor.fetchall()

Page | 17
except mysql.connector.Error as e:
print(f"Error executing query for {company}: {e}")
return []

def dealer_menu():
"""Dealer menu functionality."""
print("-----------------=MENU=--------------------------")
print("---> STOCK")
print("---> SALES")
print("---> PLACE")
choice = input("Enter your choice: ").strip().upper()
if choice == "STOCK":
def stock():
password = input("Enter your MySQL password: ").strip()
db = connect_to_db(password)
if db:
cursor = db.cursor()
company = input("Enter your company name: ").strip()
product = input("Enter the product name: ").strip()
results = search_products(cursor, company, product)
if results:
print("Stock Details:", results)
else:
print("No stock found for the specified product.")

Page | 18
db.close()
stock()
elif choice == "SALES":
print("Sales functionality coming soon!")

elif choice == "PLACE":


print("Place functionality coming soon!")

def customer_menu():
"""Customer menu functionality."""
while True:
print("-----------------=MENU=--------------------------")
print("---> MY ORDER")
print("---> PLACE ORDER")
print("---> BACK TO LOGIN")
choice = input("Enter your choice: ").strip().upper()

if choice == "PLACE ORDER":


def place_order():
password = input("Enter your MySQL password: ").strip()
db = connect_to_db(password)
if db:
cursor = db.cursor()
while True:

Page | 19
product_name = input("Enter product's name: ").strip()
company_name = input("Enter product's company:
").strip().lower()

results = search_products(cursor, company_name,


product_name)
if results:
print("Searched Items:")
for result in results:
print(result)
print("---> BUY")
print("---> ADD TO CART")
action = input("Enter your choice: ").strip().upper()

if action == "BUY":
card_details = input("Enter your card details:
").strip()
address = input("Enter your home address:
").strip()
print("Order confirmed!")
buy.append([product_name, company_name])
elif action == "ADD TO CART":
print("Item added to cart.")
add.append([product_name, company_name])
else:

Page | 20
print("Product not found or out of stock!")

more_search = input("Do you want to search more?


(yes/no): ").strip().lower()
if more_search != "yes":
break
db.close()
place_order()
print("-----------------=MENU=--------------------------")
print("---> MY ORDER")
print("---> PLACE ORDER")
print("---> BACK TO LOGIN")
choice = input("Enter your choice: ").strip().upper()
if choice == "MY ORDER":
while True:
print("---> LAST ORDER")
print("---> CART")
print("---> BACK")
sub_choice = input("Enter your choice: ").strip().upper()
if sub_choice == "LAST ORDER":
print("Your Last Orders:")
for order in buy:
print(order)
elif sub_choice == "CART":

Page | 21
print("Items in your cart:")
for item in add:
print(item)
elif sub_choice == "BACK":
break
else:
print("Invalid choice! Try again.")

elif choice == "BACK TO LOGIN":


print("Returning to the login page...")
break

else:
print("Invalid choice! Please select a valid option.")

# Main Program
print("Welcome to DRIFT!")
input("Press any key to start...")
print("Starting...")

while True:
print("LOGIN PAGE")
print("1 = DEALER")
print("2 = CUSTOMER")

Page | 22
print("3 = EXIT")
user_type = input("Enter your choice (1/2/3): ").strip()

if user_type == "1":
print("PLEASE ENTER YOUR LOGIN INFO:")
uname = input("Enter your dealer username: ").strip()
password = input("Enter your password: ").strip()
if uname == "A" and password == "dealer":
print("Hello, Dealer!")
dealer_menu()
else:
print("Invalid credentials!")

elif user_type == "2":


print("PLEASE ENTER YOUR LOGIN INFO:")
uname = input("Enter your customer username: ").strip()
password = input("Enter your password: ").strip()
if uname == "USER" and password == "custom123":
print("Hello, Customer!")
customer_menu()
else:
print("Invalid credentials!")

elif user_type == "3":

Page | 23
print("Thank you for visiting! Exiting...")
break

else:
print("Invalid selection! Please try again.")

Page | 24
mySQL
CODES

Page | 25
Creating database:

creating a table:

inserting values in table:

Page | 26
OUTPUT
interface

Page | 27
Page | 28
BIBLIOGRAPHY
The references used for the development
of this program are:

 Computer Science textbook-


Class 12: Sumita Arora
Class 11: Sumita Arora
 www.python.org
 www.mysql.com
 https://www.google.com/
 https://www.python.org.in/
 https://www.mysql.org/
 https://www.chatgpt.com/

Page | 29

You might also like