0% found this document useful (0 votes)
52 views47 pages

Utkarsh Store by Utkarsh Mishra - Utkarsh Mishra

Future purpose

Uploaded by

yazhinivel2007
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)
52 views47 pages

Utkarsh Store by Utkarsh Mishra - Utkarsh Mishra

Future purpose

Uploaded by

yazhinivel2007
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/ 47

COMPUTER SCIENCE

PROJECT

(PYTHON – Using concept of binary


and csv file)
Utkarsh Store

CERTIFICATE
This is to certify that the project
entitled ‘Utkarsh Store’ is prepared
under my guidance and supervision
by :

Name : UTKARSH MISHRA


Class : XII-E
Roll No. :-- 38
Subject :-- Computer Science
Session :-- 2021-2022

Ms. Pallavi Sharma


(PGT Computer Science)
Acknowledgement I
would like to express my special
thanks to my teacher Ms. Pallavi
Sharma who has always guided me
and given me this golden
opportunity to work on this
wonderful project which helped
me a lot with my concepts.
I would also like to express my
gratitude to
my parents and friends who helped
me in finalizing this project within the
limited time frame.
ABOUT:
Description: This is an program that simulates
a store system. It provides a secure and
interactive interface which uses concepts of
binary files and csv files (i.e. comma separated
values files) in python. The program has two
interactive modes:— Customer and owner
mode, in the customer mode person can view
items in the store, purchase them, the person
can also view whether a product is available or
not. In the owner mode program asks for the
password because it makes it secure. This
owner mode itself has two different modes
which allows the owner to look after the store
and its employees.
The store mode allows owner to add
products ,delete products, update products
info. ,display products. Whereas, the employee
mode is primarily focused on their attendance;
it allows to add records, delete them , update
records, search records and even display them.
LANGUAGES USED:
1.Python
Modules used:
1.OS
2.CSV
3.Pickle

PROGRAM
#----------FUNCTIONS----USED----IN----THIS----
BINARY__FILE----PROGRAM---------------
f=open("attendance.csv","w")
f.close()
def addition():
f=open("store.dat","ab")
n=input("enter product name:")
p=eval(input("enter price:"))
r=int(input("enter product number:"))
pickle.dump([r,n,p],f)
f.close()
def disp():
f=open("store.dat","rb")
while True:
try:
print(pickle.load(f))
except:
break
f.close()

def sear():
f=open("store.dat","rb")

n=input("enter product name for searching")


while True:
try:
t=pickle.load(f)
if t[1]==n:
print(t)
except:
print("not available in store right now...")
break
f.close()
import os
def updation():
f=open("store.dat","rb")
f1=open("temp.dat","wb")
n=input("enter product name for updation")
while True:
try:
t=pickle.load(f)
if t[1]==n:
t[0]=int(input("enter the product number"))
t[1]=input("enter product name")
t[2]=eval(input("enter price"))
pickle.dump(t,f1)
else:
pickle.dump(t,f1)
except:
break
f.close()
f1.close()
os.remove("store.dat")
os.rename("temp.dat","store.dat")

def delete():
f=open("store.dat","rb")
f1=open("temp.dat","wb")
n=int(input("enter product name for deletion"))
while True:
try:
t=pickle.load(f)
if t[1]!=n:
pickle.dump(t,f1)
except:
break
f.close()
f1.close()
os.remove("store.dat")
os.rename("temp.dat","store.dat")
def calculation():
f=open("store.dat","rb")
disp()
n=input("enter product name for purchase")
while True:
try:
t=pickle.load(f)
if t[1]==n:
q=t[2]
except:
break
r=q
z=int(input("enter the quantity"))
total=r*z
print("Your total raises to:",total,"Rs")
print("dont forget to take the bill :) ")
f.close()

#------FUNCTIONS-----USED------IN-----THIS-----CSV__FILE----
PROGRAM-------
import csv
def add():
f=open("attendance.csv","a")
r=csv.writer(f,lineterminator='\n')
i=int(input("how many records do u want to enter:"))
for n in range(i):
d=input("enter the date in format(dd-mm-yyyy):")
na=input("enter the name:")
a=input("please enter whether the employee wass present or
absent(P/A):")
p=[d,na,a]
r.writerow(p)
f.close()
def dele():
f=open("attendance.csv",'r')
q=csv.reader(f)
t=[]
all=[]
c=0
for i in q:
if c==0:
t.append(list(i))
else:
all.append(list(i))
c=c+1
z=[]
s=input("enter employee name which u want to delete")
for i in all:
if i[1]!=s:
z.append(list(i))
f.close()
f=open("attendance.csv",'w')
t=csv.writer(f)
t.writerow(['DATE','NAME','ATTENDANCE'])
for i in z:
t.writerow(i)

def up():
f=open("attendance.csv",'r')
q=csv.reader(f)
t=[]
e=[]
c=0
for i in q:
if c==0:
t.append(list(i))
else:
e.append(list(i))
c=c+1
print(e)
z=[]
s=input("enter employee name which u want to update")
for i in e:
if i[1]==s:
i[0]=input("enter date")
i[2]=input("whether absent or present(P/A)")
z.append(list(i))
else:
z.append(list(i))

f.close()
f=open("attendance.csv",'w',newline="")
t=csv.writer(f)
t.writerow(['DATE','NAME','ATTENDANCE'])
for i in z:
t.writerow(i)

def display():
f1=open("attendance.csv","r")
r=csv.reader(f1)
next(r)
for i in r:
print(i)
f1.close()
def search():
f=open("attendance.csv","r")
g=csv.reader(f)
q=input("on which basis do you want to search the
attendance(name/date):")
next(g)
if q=='name':
n=input("enter the name:")
for i in g:
if i[1]==n:
print(i)

elif q=='date':
d=input("enter the date in (dd-mm-yyyy) format:")
for i in g:
if i[0]==d:
print(i)

else:
print("enter valid choice *_*")
#-----------------------------------------------------------------------------
import pickle
n=input("please tell us whether you are the owner or customer:")
#--------------------------------------------------------CUSTOMER------
if n=="customer":
d=0
while True:
print("_"*30)
print("----- welcome to my store -----")
print("_"*30)
print("|1.| search any product ")
print("_"*30)
print("|2.| display all products ")
print("_"*30)
print("|3.| purchase any product ")
print("_"*30)
print("|4.| get your bill and exit ")
print("_"*30)
#e=input("pls tell whether u are using this program first
time(y/n):")
#if e=='y':
#for i in range(1):
f=open("store.dat","wb")
pickle.dump([1,"pen",10],f)
pickle.dump([2,"pencil",5],f)
pickle.dump([3,"notebook",50],f)
pickle.dump([4,"eraser",5],f)
pickle.dump([5,"sharpener",5],f)
pickle.dump([6,"glue",15],f)
pickle.dump([7,"scale",5],f)
pickle.dump([8,"ball pen refill",3],f)
pickle.dump([9,"gel pen refill",5],f)
f.close()
ch=int(input("enter ur choice"))
if ch==1:
sear()
elif ch==2:
disp()
elif ch==3:
calculation()
elif ch==4:
d=1
break
#-----------------------------------------------------------OWNER-----------
elif n=="owner":
p=int(input("enter the password:"))
if p==384168:
print("Welcome to the store Sir/Ma'am:")
o=input("Sir/Ma'am please tell me with what i may help
you( store or attendance of employees):")
if o=="store":
n=0
while True:
print("|1.| add new product ")
print("|2.| update records ")
print("|3.| delete records ")
print("|4.| display products ")
print("|5.| exit from the program")
ch=int(input("enter the option sir/ma'am:"))
if ch==1:
addition()
elif ch==2:
updation()
elif ch==3:
delete()
elif ch==4:
display()
elif ch==5:
n=1
break
else:
print("sorry sir/ma'am *_*")
print("we could not find it")
print("sir/ma'am please enter valid option:")
elif o=="attendance":
n=0
while True:
print("|1.| add records ")
print("|2.| update records ")
print("|3.| search records ")
print("|4.| display records")
print("|5.| delete records")
print("|6.| exit from the program")

ch=int(input("please enter the choice"))


if ch==1:
add()
elif ch==2:
up()
elif ch==3:
search()
elif ch==4:
display()
elif ch==5:
dele()

elif ch==6:
n=1
break
else:
print("please enter valid choice")

else:
print("incorrect password *_*")
OUTPUT
1. CUSTOMER MODE
a) search any product:-

b) display products:-
c) purchase products:-
2. OWNER MODE:--
a. STORE MODE:-
A) add new product:-
B) update products:-

C) delete products:-

D) Display products:-
b. Attendance mode:-
A) add records:-

B) update records:-
C) Search records:-

D)Display records:-
E) Delete records:-

IMAGES USED IN THE PROJECT:


1) https://schoolwiser.com/schools/delhi/army-public-
school-dhaula-kuan

END OF THE
PROJECT…………
………………..
THANK YOU!!

You might also like