Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

COMPUTER SCIENCE

PROJECT

TOPIC: E-COMMERCE ON
GROCERIES

Made By-
Samanyu Kaushal
XII-E
Roll No.- 33
This is to certify that the project entitled
“E-COMMERCE ON GROCERIES”
is prepared under my guidance and supervision by
Name: Samanyu Kaushal
Roll No: 33
Class: XII-E
Subject: Computer Science
Session: 2020-21

Submitted To: Ms. Pallavi Sharma


Signature:
ACKNOWLEDGEMENT

I extend my deep sense of gratitude and sincere thanks


to our subject teacher, Ms. Pallavi Sharma for her
valuable support and guidance in carrying out my
project work.

I also express my gratitude to my parents and my


fellow mates who have helped me to carry out this
work. Last but not the least, I thank the almighty God
for His blessing showed on me during this period.
#CODE FOR E-COMMERCE ON GROCERIES

# create table ECommerce(Sno int(5),ID int(5),Name


varchar(50),Description varchar(50),Costprice
float(20),SalePrice float(20));
import mysql.connector as m
conn=m.connect(host='localhost',user='root',passwd='1234',databa
se='test')
cur=conn.cursor()
d=1
while(d==1):
print("1.Enter Records")
print("2.Display all Records")
print("3.Delete Records According to Sno")
print("4.Search Record")
print("5.Calculate Profit Per Item and Discount")
print("6.Exit")
ch=int(input("Enter your choice"))
if(ch==1):
l=[]
a=int(input("Enter sno"))
l.append(a)
b=int(input("Enter id"))
l.append(b)
n=input("Enter item")
l.append(n)
x=input("Enter description")
l.append(x)
y=int(input("Enter costprice"))
l.append(y)
z=int(input("Enter saleprice"))
l.append(z)
s="Insert into ecommerce values(%s,%s,%s,%s,%s,%s)"
q=l
cur.execute(s,q)
conn.commit()
elif(ch==2):
cur.execute("select * from ecommerce")
for i in cur:
print(i)
elif(ch==3):
s="delete from ecommerce where sno=%s"
r=int(input("Enter Sno"))
q=(r,)
cur.execute(s,q)
conn.commit()
elif(ch==4):
s="select * from ecommerce where sno=%s"
r=int(input("Enter Sno"))
q=(r,)
cur.execute(s,q)
for i in cur:
print(i)
elif(ch==5):
cur.execute("select Sno,Name,SalePrice,SalePrice-
CostPrice 'Profit', 20/100*SalePrice 'Discount',
SalePrice-20/100*SalePrice 'DiscountedPrice' from
ecommerce")
t=[]
for i in cur:
t.append(i)
fc="%3s %20s %24s %28s %32s %36s"

print(fc%('Sno','Name','SalePrice','Profit','Discount','Discount
edPrice'))
print("="*120)
rf="%3s %20s %24s %28s %32s %36s"
for j in t:
print(rf%(j[0], j[1], j[2], j[3], j[4], j[5]))
print("-"*200)
elif(ch==6):
d=0
else:
print("Enter choice from 1 to 6")
#OUTPUT
1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
Enter your choice1
Enter sno11
Enter id11
Enter itemChocolate Cookies
Enter descriptionContains Caramel (3 cookies)
Enter costprice2
Enter saleprice4
1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
Enter your choice2

1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
Enter your choice3
Enter Sno9
1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
Enter your choice2
1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
Enter your choice4
Enter Sno11
(11, 11, 'Chocolate Cookies', 'Contains Caramel (3 cookies)',
Decimal('2.00'), Decimal('4.00'))
1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
Enter your choice5
1.Enter Records
2.Display all Records
3.Delete Records According to Sno
4.Search Record
5.Calculate Profit Per Item and Discount
6.Exit
Enter your choice6

You might also like