0% found this document useful (0 votes)
5 views

Project

Uploaded by

Preksha Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Project

Uploaded by

Preksha Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

BHARTI PUBLIC SCHOOL

Name:- Vansh Jain


Class:- 12th - A
Subject:- Computer Science
Subject Code:- 083
Roll Number:-
Apple
Store
Management
PROJECT
MENU DRIVEN PROGRAM

ACADEMIC YEAR: 2023-2024

ROLL NO :
NAME : Vansh Jain
CLASS : XII-A
SUBJECT : COMPUTER SCIENCE
SUB CODE : 083

PROJECT GUIDE: This is a menu driven program in which the


connectivity between Python and SQL is used to make a
management for the owner of the Apple Store and it also
contains customer interface.
Index
1. Certificate
2. Acknowledgement
3. Source Code
4. Tables Used
5. Output
6. Bibliography
CERTIFICATE

This is to certify that Vansh Jain Roll No: has successfully


completed the project Work entitled Apple Store Management
in the subject Computer Science (083) laid down in the
regulations of CBSE for the purpose of Practical Examination in
Class XII.

Name of Examiner:

Signature:
ACKNOWLEDGEMENT

Apart from the efforts of me, the success of any project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express
my gratitude to the people who have been instrumental in the successful
completion of this project.

I express deep sense of gratitude to almighty God for giving me strength for the
successful completion of the project.

I express my heartfelt gratitude to my parents for constant encouragement while


carrying out this project.

I gratefully acknowledge the contribution of the individuals who contributed in


bringing this project up to this level, who continues to look after me despite my
flaws.

I express my deep sense of gratitude to the luminary. The Principal, S. Sabharwal


who has been continuously motivating and extending their helping hand to us.

I express my sincere thanks to the Computer Science teacher


Mrs. Priyanka Rastogi for constant encouragement and the guidance provided
during this project.

My sincere thanks to the teacher, and all the friends, who critically reviewed my
project and helped in solving each and every problem, occurred during
implementation of the project

The guidance and support received from all the members who contributed and
who are contributing to this project, was vital for the success of the project. I am
grateful for their constant support and help.
SOURCE CODE
import mysql.connector

db = mysql.connector.connect(host='localhost', user='root', passwd='123456789', database='store')


cursor = db.cursor()

def billing(price):
name = input('Enter your name: ')
ph = int(input('Enter your phone number: '))

print('------------Apple Store------------')
print()
print('Name= ', name, '\t\t', 'Phone No.: ', ph)
print('Item Bought: ', item)
print('Total bill: ', price)
print('------------------------------------------')
print('Thank you for shopping with us!!!')

cursor.execute('''CREATE TABLE IF NOT EXISTS cust_det


(Name VARCHAR(30),
Phone_no BIGINT(12),
Item VARCHAR(50),
Total_Bill INT(9))''')

cursor.execute('INSERT INTO cust_det (Name, Phone_no, Item, Total_Bill) VALUES (%s, %s, %s, %s)',
(name, ph, item, price))

print('Data Inserted Successfully!!')


db.commit()

def choice=input('Would you liketo do anything else(Y/N): ')


if choice=='Y' or choice=='y':
continue
else:
break:
exit()
print('Thank you for visiting us!!')

while True:
print()
print('Welcome to Apple Store')
print()
print('1. Admin')
print('2. Customer Profile')
print('3. Exit')

ch = int(input('Enter your choice(1/2/3): '))

if ch == 1:
user = input('Enter your username: ')
passwd = input('Enter your password: ')

if user == 'Admin' and passwd == 'dbsb3272':


print('Welcome Admin')
print('What would you like to do? ')
print('1. See Database')
print('2. Modify Database')
ch1 = int(input('Enter your choice(1/2): '))

if ch1 == 1:
print("Here are the products to look into databases:")
print("1. Iphone")
print("2. Ipad")
print("3. Apple Watch")
print("4. Macbook")
comp = int(input("Enter your choice:"))

if comp == 1:
cursor.execute("SELECT * FROM iphones")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
elif comp == 2:
cursor.execute("SELECT * FROM ipad")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
elif comp == 3:
cursor.execute("SELECT * FROM watch")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
elif comp == 4:
cursor.execute("SELECT * FROM macbook")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

elif ch1 == 2:
print('1.Update Price')
print('2. delete a Product')
print('3. Add a Product')
ch2 = int(input('Enter your choice(1/2/3): '))

if ch2 == 1:
print("Here are the products to modify databases: ")
print("1. Iphone")
print("2. Ipad")
print("3. Apple Watch")
print("4. Macbook")
ch = int(input("Enter your choice(1/2/3/4): "))

if ch == 1:
cursor.execute("SELECT * FROM iphone")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
z = int(input("Enter the new price of product:"))
query = "UPDATE iphones SET Price = {} WHERE Model = '{}'".format(z, y)
print(query)
cursor.execute(query)
db.commit()
print("UPDATED")

elif ch == 2:
cursor.execute("SELECT * FROM ipad")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
z = int(input("Enter the new price of product:"))
query = "UPDATE ipad SET Price = {} WHERE Model = '{}'".format(z, y)
print(query)
cursor.execute(query)
db.commit()
print("UPDATED")

elif ch == 3:
cursor.execute("SELECT * FROM watch")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
z = int(input("Enter the new price of product:"))
query = "UPDATE watch SET Price = {} WHERE Model = '{}'".format(z, y)
print(query)
cursor.execute(query)
db.commit()
print("UPDATED")

elif ch == 4:
cursor.execute("SELECT * FROM macbook")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
z = int(input("Enter the new price of product:"))
query = "UPDATE macbook SET Price = {} WHERE Model = '{}'".format(z, y)
print(query)
cursor.execute(query)
db.commit()
print("UPDATED")

elif ch2 == 2:
print("Here is the list of products ")
print("1. Iphone")
print("2. Ipad")
print("3. Apple Watch")
print("4. Macbook")
ch3 = int(input("Enter your choice(1/2/3/4): "))

if ch3 == 1:
cursor.execute("SELECT * FROM iphones")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
cursor.execute('''DELETE FROM iphones WHERE Model = %s''', (y,))
db.commit()
print('Successfully DELETED!!')

elif ch3 == 2:
cursor.execute("SELECT * FROM ipad")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
cursor.execute('''DELETE FROM ipad WHERE Model = %s''', (y,))
db.commit()
print('Successfully DELETED!!')

elif ch3 == 3:
cursor.execute("SELECT * FROM watch")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
cursor.execute('''DELETE FROM watch WHERE Model = %s''', (y,))
db.commit()
print('Successfully DELETED!!')

elif ch3 == 4:
cursor.execute("SELECT * FROM macbook")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)
y = input("Enter the name of the product:")
cursor.execute('''DELETE FROM macbook WHERE Model = %s''', (y,))
db.commit()
print('Successfully DELETED!!')

elif ch2==3:
print("Here is the list of products ")
print("1. Iphone")
print("2. Ipad")
print("3. Apple Watch")
print("4. Macbook")
ch4 = int(input("Enter your choice(1/2/3/4): "))

if ch4==1:
x=input('Enter the name of the product: ')
y=int(input('Enter the price: '))
cursor.execute("INSERT INTO iphones (Model, Price) VALUES (%s, %s)", (x,y))
db.commit()
print("New product added successfully!")

if ch4==2:
x=input('Enter the name of the product: ')
y=int(input('Enter the price: '))
cursor.execute("INSERT INTO ipad (Model, Price) VALUES (%s, %s)", (x,y))
db.commit()
print("New product added successfully!")

if ch4==3:
x=input('Enter the name of the product: ')
y=int(input('Enter the price: '))
cursor.execute("INSERT INTO watch (Model, Price) VALUES (%s, %s)", (x,y))
db.commit()
print("New product added successfully!")

if ch4==4:
x=input('Enter the name of the product: ')
y=int(input('Enter the price: '))
cursor.execute("INSERT INTO macbook (Model, Price) VALUES (%s, %s)", (x,y))
db.commit()
print("New product added successfully!")

else:
print('Incorrect username or password')
c=input('Would you like to try again(Y/N): ')
if c=='Y' or c=='y':
continue
else:
choice=input('Would you liketo do anything else(Y/N): ')
if choice=='Y' or choice=='y':
continue
else:
break
break

if ch==2:
print('1. View Products')
print('2. Buy Products')
ch5=int(input('Enter your choice(1/2): '))

if ch5==1:
print("Here are the products to look into databases:")
print("1. Iphone")
print("2. Ipad")
print("3. Apple Watch")
print("4. Macbook")
comp = int(input("Enter your choice:"))

if comp == 1:
cursor.execute("SELECT * FROM iphones")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

elif comp == 2:
cursor.execute("SELECT * FROM ipad")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

elif comp == 3:
cursor.execute("SELECT * FROM watch")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

elif comp == 4:
cursor.execute("SELECT * FROM macbook")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

if ch5==2:
print("Here are the products to look into databases:")
print("1. Iphone")
print("2. Ipad")
print("3. Apple Watch")
print("4. Macbook")
comp = int(input("Enter your choice:"))

if comp == 1:
cursor.execute("SELECT * FROM iphones")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

elif comp == 2:
cursor.execute("SELECT * FROM ipad")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

elif comp == 3:
cursor.execute("SELECT * FROM watch")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

elif comp == 4:
cursor.execute("SELECT * FROM macbook")
myrecords = cursor.fetchall()
for i in myrecords:
print(i)

print("1. Iphone")
print("2. Ipad")
print("3. Apple Watch")
print("4. Macbook")
cat = int(input('Enter the category number: '))

if cat == 1:
item = input('Enter the name of the product: ')
cursor.execute("SELECT Price FROM Iphones WHERE Model = %s", (item,))
prod = cursor.fetchone()
c=prod[0]
price=int(c)
billing(price)
choice=input('Would you liketo do anything else(Y/N): ')
if choice=='Y' or choice=='y':
continue
else:
break

elif cat == 2:
item = input('Enter the name of the product: ')
cursor.execute("SELECT Price FROM Ipad WHERE Model = %s", (item,))
prod = cursor.fetchone()
c=prod[0]
price=int(c)
billing(price)
choice=input('Would you liketo do anything else(Y/N): ')
if choice=='Y' or choice=='y':
continue
else:
break

elif cat == 3:
item = input('Enter the name of the product: ')
cursor.execute("SELECT Price FROM Watch WHERE Model = %s", (item,))
prod = cursor.fetchone()
c=prod[0]
price=int(c)
billing(price)
choice=input('Would you liketo do anything else(Y/N): ')
if choice=='Y' or choice=='y':
continue
else:
break

elif cat == 4:
item = input('Enter the name of the product: ')
cursor.execute("SELECT Price FROM Macbook WHERE Model = %s", (item,))
prod = cursor.fetchone()
c=prod[0]
price=int(c)
billing(price)
choice=input('Would you liketo do anything else(Y/N): ')
if choice=='Y' or choice=='y':
continue
else:
break
else:
print('Wrong input!!')

if ch==3:
exiting()
TABLES USED
IPHONES
MACBOOK

IPAD

WATCH
OUTPUT
BIBLIOGRAPHY

GEEKSFORGEEKS.ORG
STACKOVERFLOW.COM

You might also like