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

COMPUTER SCIENCE

PROJECT

TOPIC- GROCERY SHOP

MADE BY-

NAME- Amit Kumar Gujar


CLASS- XII F
ROLL NO. - 05
CERTIFICATE

This is to certify that project entitled


‘GROCERY SHOP’ is prepared under
my guidance and supervision by:

NAME= Amit Kumar Gujar


CLASS= XII F
ROLL NO.= 05
SUBJECT= Computer Science
SESSION= 2021-2022

Submitted To: Ms. Pallavi Sharma


Signature:
ACKNOWLEDGEMENT
I extend my deep sense of gratitude and
sincere thanks to our 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.
ABOUT THE PROJECT

This is a program that allow the user to assert the


grocery shop.

It basically do the followings-


1. Shows info of the shop
2. Calculate the net amount
3. Adds the new items
4. It displays all the item
5. It can search any particular item
THE CODE
#PROJECT
#GROCERY SHOP
import pickle # for pickle.dump(), pickle.load()
import sys
def info():
print("INFORMATION")
def calc():
print("list of item \n 1-rice_rs.100 \ 2-wheat flour_rs.50")
item=int(input("enter your item"))
qyt=int(input("enter the qyt"))
if item==1:
net=100*qyt
if item ==2:
net=50*qyt
print("net amout",net)
dict={}
def write_in_file():
file=open("grocery.dat","ab")
no=int(input("ENTER NO OF ITEMS"))
for i in range(no):
print("Enter item",i+1,"details")
dict["itemno"]=int(input("enter the itemno"))
dict["iname"]=input("enter the item name")
dict["rate"]=int(input("enter the rate"))
dict["qyt"]=int(input("enter the qty"))
pickle.dump(dict,file)
file.close()
def display():
file=open("grocery.dat","rb")
try:
while True:
items=pickle.load(file)
print(items)
except EOFError:
pass
file.close()
def search():
file=open("grocery.dat","rb")
n=int(input("enter the itemno to search"))
found=0
try:
while True:
data=pickle.load(file)
if data["itemno"]==n:
print("record found")
print(data)
found=1
break
except EOFError:
pass
if found==0:
print("record not found")
file.close()

#main
print("grocery shop")
while True:
print("menu \n 1-info \n 2-net amount \n 3-writing in a file \n 4-display \n
5-search \n 6-sys.exit")
ch=int(input("enter your choice"))
if ch==1:
info()
if ch==2:
calc()
if ch==3:
write_in_file()
if ch==4:
display()
if ch==5:
search()
if ch==6:
sys.exit()
OUTPUT

grocery shop
menu
1-info
2-net amount
3-writing in a file
4-display
5-search
6-sys.exit
enter your choice1
INFORMATION
menu
1-info
2-net amount
3-writing in a file
4-display
5-search
6-sys.exit
enter your choice2
list of item
1-rice_rs.100 \ 2-wheat flour_rs.50
enter your item1
enter the qyt3
net amout 300
menu
1-info
2-net amount
3-writing in a file
4-display
5-search
6-sys.exit
enter your choice3
ENTER NO OF ITEMS2
Enter item 1 details
enter the itemno5
enter the item namechocolate
enter the rate50
enter the qty50
Enter item 2 details
enter the itemno6
enter the item nameMilk
enter the rate60
enter the qty100
menu
1-info
2-net amount
3-writing in a file
4-display
5-search
6-sys.exit
enter your choice4
{'itemno': 5, 'iname': 'chocolate', 'rate': 50, 'qyt': 50}
{'itemno': 6, 'iname': 'Milk', 'rate': 60, 'qyt': 100}
menu
1-info
2-net amount
3-writing in a file
4-display
5-search
6-sys.exit
enter your choice5
enter the itemno to search5
record found
{'itemno': 5, 'iname': 'chocolate', 'rate': 50, 'qyt': 50}
menu
1-info
2-net amount
3-writing in a file
4-display
5-search
6-sys.exit
enter your choice6
LIMITATION

It is not a large-scale system. Only limited


information provided by this system.
People who are not familiar with computers
can’t use this system.

You might also like