the mall of emirates - python class room diary · a project report submitted in partial fulfillment...
TRANSCRIPT
THE MALL OF EMIRATES
A Project Report Submitted in Partial Fulfillment of the Requirements
AISSCE - All India Senior School Certificate Examination 2019-2020: SCIENCE – XII A
In
COMPUTER SCIENCE (083)
By: 1. AANCHAL –XII A – ROLL NO: 4
2. ARSI – XII A – ROLL NO: 5 3. RITIKA – XIIA – ROLL NO: 18
4. SHAMBHVI – XII A – ROLL NO: 21
KENDRIYA VIDYALAYA HOLTA CAMP PALAMPUR
JANUARY , 2020
2
UNDERTAKING
We declare that the work presented in this project titled “THE MALL OF
EMIRATES”, submitted to Sh. Sanjeev Sharma PGT-Computer Science
Kendriya Vidyalaya Holta Camp Palampur for the award of the CBSE - AISSE
class XII certificate. We have not plagiarized or submitted the same work for the
award of any other examination. In case this undertaking is found incorrect, we
accept that our Certificates may be unconditionally withdrawn.
January, 2020
Place : Kendriya Vidyalaya Palampur
1.AANCHAL 2.ARSI 3.RITIKA
4.SHAMBHVI
3
CERTIFICATE
Certified that the work contained in the project titled
“THE MALL OF EMIRATES”, by “AANCHAL , ARSI ,
RITIKA , SHAMBHVI”, has been carried out under my
supervision and that this work has not been submitted
elsewhere for a AISSE certificate.
Mentor: (LALIT KUMAR) PRINCIPAL KENDRIYA VIDYALAYA PALAMPUR
Project Guide:
Sanjeev Sharma PGT-Computer Science Kendriya Vidyalaya Palampur
4
Acknowledgements
We would like to thank Sh. Lalit Kumar, Principal Kendriya Vidyalaya
Palampur.
We are deeply indebted to our mentor Sh. Sanjeev Sharma.
We further thank to all the staff members of Kendriya Vidyalaya Palampur.
We owe our sincere gratitude towards Kendriya Vidyalaya Sangathan.
Our heartfelt thanks to CBSE.
We also express our deepest gratitude to our parents.
Finally, we would like to wind up by paying our heartfelt thanks to all our near and dear ones.
1.AANCHAL 2.ARSI 3.RITIKA
4.SHAMBHVI
5
Contents
1. Introduction of the Project.
2. System Requirements of the Project.
3. Python Coding.
4. Output of the Project.
5. References.
6
Introduction of the Project
We the students of CLASS XII A of KENDRIYA VIDYALAYA PALAMPUR HOLTA have been assigned the work of “ THE MALL OF EMIRATES ”. To perform this task the students were divided into the group of four students named as AANCHAL ,ARSI,RITIKA,SHAMBHVI.
AANCHAL and SHAMBHVI has been assigned the work of coding and programming RITIKA and ARSI have been assigned the work of analyzing the overall mistakes and have done the conclusion work. The project starts with – ENTER 1---->FOR NEW ITEM ENTER 2---->FOR WOMEN SECTION ENTER 3---->FOR MEN SECTION ENTER 4---->FOR KID SECTION ENTER 5---->FOR MODIFY ITEM ENTER 6---->FOR SEARCH ITEM ENTER 7---->FOR SHOW ALL INVENTORY ITEM WISE ENTER 8---->FOR REMOVE ITEM ENTER 9---->LIST ALL BILLS ENTER 10--->GENERATE CUSTOMER BILL ENTER 11--->EXIT We are so glad that this work have been assigned to us,yet we haven’t done this work before .SH. SANJEEV SHARMA our subject teacher have also helped us a lot to complete this project. We feel so blessed that we have learnt all this work with the help of our sir,we are also thankful to our respected principal SH.LALIT KUMAR GUPTA for providing us various facilities to complete this project. As we are the students of CLASS XIIA and we haven’t done this type of project before, we have performed all that which we have learnt from our CBSE PROGRAMMING .Hence, we know that this programming would be further done on a big platform. Since we have
7
started this programming from SEPTEMBER month ,we believe that this programming would further help us a lot in our future . We are also thankful to our groupmates for cooperating with each other while performing this task we have also polished the skills of group activity. PROCESS FIRSTLY, we have done the planning in a paper work regarding what have to do on the assigned project THE MALL OF EMIRATES. SECONDLY, we discussed our planning with our subject teacher and then he provided us the right path to perform the work. NEXT, we started our project on foot paths of our subject teacher. THEN, we started our coding, coding took around 2 and half months for completion. NEXT, we analyzed the mistakes done and then we corrected them. THEN, we prepared the project format as shown above.
THANKS TO ALL OF WORTHY TEACHERS AND PRINCIPAL AND MY DEAR GROUP MATES ALSO A GREAT THANKS TO KENDRIYA VIDYALAYA SANGATHAN FOR PROVIDING US THIS GOLDEN OPPORTUNITY …………
8
System Requirements of the Project
Recommended System Requirements
Processors: Intel® Core™ i3 processor 4300M at 2.60 GHz. Disk space: 2 to 4 GB. Operating systems: Windows® 10, MACOS, and UBUNTU. Python Versions: 3.X.X or Higher. Minimum System Requirements
Processors: Intel Atom® processor or Intel® Core™ i3 processor. Disk space: 1 GB. Operating systems: Windows 7 or later, MACOS, and UBUNTU. Python Versions: 2.7.X, 3.6.X.
Prerequisites before installing MySQL Connector Python You need root or administrator privileges to perform the installation process. Python must be installed on your machine. Note: – MySQL Connector Python requires python to be in the system’s PATH. Installation fails if it doesn’t find Python. On Windows, If Python doesn’t exist in the system’s PATH, please manually add the directory containing python.exe yourself.
9
Python Coding #***************KENDRIYA VIDYALAYA PALAMPUR ****************** #***************WELCOME TO THE MALL OF EMIRATES*************** ################## THE MALL OF EMIRATESI ##################### #*******Designed and Maintained By: #*******AANCHAL - CLASS XII A - ROLL NO - 4 [ 2019-2020 ] #*******ARSI - CLASS XII A - ROLL NO - 6 [ 2019-2020 ] #*******RITIKA - CLASS XII A - ROLL NO - 18 [ 2019-2020 ] #*******SHAMBHVI - CLASS XII A - ROLL NO - 21 [ 2019-2020 ] import mysql.connector # GLOBAL VARIABLES DECLARATION myConnnection ="" cursor="" userName="" password ="" pcode="" #MODULE TO CHECK MYSQL CONNECTIVITY def MYSQLconnectionCheck (): global myConnection global userName global password userName = input("\n ENTER MYSQL SERVER'S USERNAME : ") password = input("\n ENTER MYSQL SERVER'S PASSWORD : ") myConnection=mysql.connector.connect(host="localhost",user=userName,passwd=password , auth_plugin='mysql_native_password' ) if myConnection: print("\n CONGRATULATIONS ! YOUR MYSQL CONNECTION HAS BEEN ESTABLISHED !") cursor=myConnection.cursor()
10
cursor.execute("CREATE DATABASE IF NOT EXISTS EMIRATESI") cursor.execute("COMMIT") cursor.close() return myConnection else: print("\nERROR ESTABLISHING MYSQL CONNECTION CHECK USERNAME AND PASSWORD !") #MODULE TO ESTABLISHED MYSQL CONNECTION def MYSQLconnection (): global userName global password global myConnection global cid global pcode myConnection=mysql.connector.connect(host="localhost",user=userName,passwd=password , database="EMIRATESI" , auth_plugin='mysql_native_password' ) if myConnection: return myConnection else: print("\nERROR ESTABLISHING MYSQL CONNECTION !") myConnection.close() #MODULE FOR MEN'S SECTION def menSection(): global pcode if myConnection: cursor=myConnection.cursor() print("ITEMS UNDER THE MENS SECTION ARE : ") sql="SELECT * FROM PRODUCT WHERE PRODUCT_CATEGORY=%s" cursor.execute(sql,("Men",)) data=cursor.fetchall() if data: print(data)
11
while True: print(""" ENTER 1 TO BUY ENTER 0 TO RETURN TO MAIN MENU """) choice = int(input("Please Enter Your Choice : ")) if choice == 1 : item = searchItem() if item: cursor=myConnection.cursor() createTable =""" CREATE TABLE IF NOT EXISTS BILL(BILL_CODE VARCHAR(10) PRIMARY KEY ,PRODUCT_CODE VARCHAR(10),CID VARCHAR(10), CNAME VARCHAR(30), PRICE INT ,QUANTITY INT , DISCOUNT INT ,TOTAL INT ); """ cursor.execute(createTable) bnumber=input("\n Enter BILL Number : ") cid=input("\n Enter Customer Identification No. : ") cname=input("\n Enter Customer Name : ") price=int(input("\n Enter Price : ")) quantity=int(input("\n Enter Quantity : ")) discount=int(input("\n Enter Discount Amount, If any) : ")) total = (price * quantity) - discount sql= "INSERT INTO BILL VALUES(%s,%s,%s,%s,%s,%s,%s,%s)" values= (bnumber,cid,pcode,cname,price,quantity,discount,total) cursor.execute(sql,values) cursor.execute("COMMIT") print("\n ITEM ADDEDD SUCCESSSFULLY IN YOUR CART !") cursor.close() elif choice == 0: break; else:
12
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ") else: print("\nSomthing Went Wrong ,Please Try Again !") #MODULE FOR WOMEN'S SECTION def womenSection(): global pcode if myConnection: cursor=myConnection.cursor() print("ITEMS UNDER THE WOMEN SECTION ARE : ") sql="SELECT * FROM PRODUCT WHERE PRODUCT_CATEGORY=%s" cursor.execute(sql,("Women",)) data=cursor.fetchall() if data: print(data) while True: print(""" ENTER 1 TO BUY ENTER 0 TO RETURN TO MAIN MENU """) choice = int(input("Please Enter Your Choice : ")) if choice == 1 : item = searchItem() if item: cursor=myConnection.cursor() createTable =""" CREATE TABLE IF NOT EXISTS BILL(BILL_CODE VARCHAR(10) PRIMARY KEY ,PRODUCT_CODE VARCHAR(10),CID VARCHAR(10), CNAME VARCHAR(30), PRICE INT ,QUANTITY INT , DISCOUNT INT ,TOTAL INT ); """ cursor.execute(createTable) bnumber=input("\n Enter BILL Number : ") cid=input("\n Enter Customer Identification No. : ") cname=input("\n Enter Customer Name : ") price=int(input("\n Enter Price : ")) quantity=int(input("\n Enter Quantity : "))
13
discount=int(input("\n Enter Discount Amount, If any) : ")) total = (price * quantity) - discount sql= "INSERT INTO BILL VALUES(%s,%s,%s,%s,%s,%s,%s,%s)" values= (bnumber,cid,pcode,cname,price,quantity,discount,total) cursor.execute(sql,values) cursor.execute("COMMIT") print("\n ITEM ADDEDD SUCCESSSFULLY IN YOUR CART !") cursor.close() elif choice == 0: break; else: print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ") else: print("\nSomthing Went Wrong ,Please Try Again !") #MODULE FOR KIDS'S SECTION def kidsSection(): global pcode if myConnection: cursor=myConnection.cursor() print("ITEMS UNDER THE KIDS SECTION ARE : ") sql="SELECT * FROM PRODUCT WHERE PRODUCT_CATEGORY=%s" cursor.execute(sql,("Kids",)) data=cursor.fetchall() if data: print(data) while True: print(""" ENTER 1 TO BUY ENTER 0 TO RETURN TO MAIN MENU
14
""") choice = int(input("Please Enter Your Choice : ")) if choice == 1 : item = searchItem() if item: cursor=myConnection.cursor() createTable =""" CREATE TABLE IF NOT EXISTS BILL(BILL_CODE VARCHAR(10) PRIMARY KEY ,PRODUCT_CODE VARCHAR(10),CID VARCHAR(10), CNAME VARCHAR(30), PRICE INT ,QUANTITY INT , DISCOUNT INT ,TOTAL INT ); """ cursor.execute(createTable) bnumber=input("\n Enter BILL Number : ") cid=input("\n Enter Customer Identification No. : ") cname=input("\n Enter Customer Name : ") price=int(input("\n Enter Price : ")) quantity=int(input("\n Enter Quantity : ")) discount=int(input("\n Enter Discount Amount, If any) : ")) total = (price * quantity) - discount sql= "INSERT INTO BILL VALUES(%s,%s,%s,%s,%s,%s,%s,%s)" values= (bnumber,cid,pcode,cname,price,quantity,discount,total) cursor.execute(sql,values) cursor.execute("COMMIT") print("\n ITEM ADDEDD SUCCESSSFULLY IN YOUR CART !") cursor.close() elif choice == 0: break; else: print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ") else:
15
print("\nSomthing Went Wrong ,Please Try Again !") #MODULE FOR ADDING NEW ITEM def addItem(): global pcode if myConnection: cursor=myConnection.cursor() createTable =""" CREATE TABLE IF NOT EXISTS PRODUCT(PRODUCT_CODE VARCHAR(10) PRIMARY KEY, PRODUCT_CATEGORY VARCHAR(20), PRODUCT_BRAND VARCHAR(30) ,PRODUCT_NAME VARCHAR(30))""" cursor.execute(createTable) pcode=input("\nEnter Product Code : ") pcategory=input("\nEnter Product Category [ MEN/WOMEN/KIDS ] : ") pbrand=input("\nEnter Brand Name : ") pname=input("\nEnter Product Name : ") sql= "INSERT INTO PRODUCT VALUES(%s,%s,%s,%s)" values= (pcode,pcategory,pbrand,pname) cursor.execute(sql,values) cursor.execute("COMMIT") print("\nNEW ITEM ADDEDD SUCCESSSFULLY !") cursor.close() else: print("\nERROR ESTABLISHING MYSQL CONNECTION !") #MODULE FOR SEARCH AN ITEM def searchItem(): global pcode if myConnection: cursor=myConnection.cursor() pcode=input("PLEASE ENTER PRODUCT CODE : ") sql="SELECT * FROM PRODUCT WHERE PRODUCT_CODE= %s" cursor.execute(sql,(pcode,)) data=cursor.fetchall()
16
if data: print(data) return True else: return False cursor.close() else: print("\nSomthing Went Wrong ,Please Try Again !") #MODULE FOR MODIFY AN ITEM def modifyItem(): global pcode item = searchItem() if item: if myConnection: cursor=myConnection.cursor() print("PRESS 1 FOR PRODUCT NAME : ") print("PRESS 2 FOR PRODUCT CATEGORY : ") print("PRESS 3 FOR PRODUCT BRAND : ") choice=int(input("Enter Your Choice : ")) if choice==1: name=input("ENTER NEW PRODUCT NAME : ") sql="UPDATE PRODUCT SET PRODUCT_NAME= %s WHERE PRODUCT_CODE = %s" cursor.execute(sql,(name,pcode)) cursor.execute("COMMIT") print("PRODUCT NAME UPDATED SUCCESSFULLY ") elif choice == 2: category=input("ENTER NEW CATEGORY :") sql="UPDATE PRODUCT SET PRODUCT_CATEGORY= %s WHERE PRODUCT_CODE= %s" cursor.execute(sql,(category,pcode)) cursor.execute("COMMIT") print("PRODUCT CATEGORY UPDATED SUCCESSFULLY ") elif choice==3: brand=input("ENTER NEW BRAND NAME :")
17
sql="UPDATE PRODUCT SET PRODUCT_BRAND= %s WHERE PRODUCT_CODE = %s" cursor.execute(sql,(brand,pcode)) cursor.execute("COMMIT") print("BARND UPDATED SUCCESSFULLY ") else: print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ") else: print("\nSomthing Went Wrong ,Please Try Again !") else: print("Item Record Not Found , Please Try Again !") #MODULE FOR DISPLAY INVENTORY def showInventory(): if myConnection: cursor=myConnection.cursor() sql="SELECT * FROM PRODUCT GROUP BY PRODUCT_CATEGORY" cursor.execute(sql) data=cursor.fetchall() if data: print(data) return True else: return False cursor.close() else: print("\nSomthing Went Wrong ,Please Try Again !") #MODULE TO REMOVE AN ITEM def removeItem () : global pcode item = searchItem() if item : if myConnection:
18
cursor=myConnection.cursor() sql="SELECT * FROM PRODUCT WHERE PRODUCT_CODE= %s" cursor.execute(sql,(pcode,)) data=cursor.fetchall() if data: print("\n**** Item Removed Successfully !!! *****") sql="DELETE FROM PRODUCT WHERE PRODUCT_CODE=%s" cursor.execute(sql,(pcode,)) cursor.execute("COMMIT") cursor.close() else: print("\nSomthing Went Wrong ,Please Try Again !") else: print("Record Not Found , Please Try Again !") #MODULE TO LIST ALL BILLS def allBills(): if myConnection: cursor=myConnection.cursor() sql="SELECT * FROM BILL GROUP BY CID" cursor.execute(sql) data=cursor.fetchall() if data: for bill in data: print(bill) return True else: return False cursor.close() else: print("\nSomthing Went Wrong ,Please Try Again !") #MODULE TO GENERATE PARTICULAR CUSTOMER'S BILL def generateBill(): global pcode if myConnection:
19
cursor=myConnection.cursor() cid=input("\nEnter Customer Identification No. : ") sql="SELECT CNAME , SUM(TOTAL) AS 'TOTAL AMOUNT' FROM BILL GROUP BY %s" cursor.execute(sql,(cid,)) data=cursor.fetchall() if data: print("###################################") print("NAME AMOUNT") print(data) return True else: print("\nCustomer Not Found !") cursor.close() else: print("\nSomthing Went Wrong ,Please Try Again !") #MAIN SCREEN OF THE SOFTWARE print("#***************KENDRIYA VIDYALAYA PALAMPUR *******") print("#***************WELCOME TO THE MALL OF EMIRATES****") print("################## THE MALL OF EMIRATESI ##########") print("#*******Designed and Maintained By:") print("#*******AANCHAL - CLASS XII A - ROLL NO - 4 [ 2019-2020 ]") print("#*******ARSI - CLASS XII A - ROLL NO - 6 [ 2019-2020 ]") print("#*******RITIKA - CLASS XII A - ROLL NO - 18 [ 2019-2020 ]") print("#*******SHAMBHVI - CLASS XII A - ROLL NO - 21 [ 2019-2020 ]") print("********************PROUD TO BE KAVIAN ************") # MYSQL CONNECTION CHECK myConnection = MYSQLconnectionCheck () if myConnection: MYSQLconnection () while(True): print(""" 1---->FOR NEW ITEM
20
2---->FOR WOMEN SECTION 3---->FOR MEN SECTION 4---->FOR KID SECTION 5---->FOR MODIFY ITEM 6---->FOR SEARCH ITEM 7---->FOR SHOW ALL INVENTORY ITEM WISE 8---->FOR REMOVE ITEM 9---->LIST ALL BILLS 10--->GENERATE CUSTOMER BILL 11--->EXIT """) choice = int(input("Please Enter Your Choice : ")) if choice == 1: addItem() elif choice ==2: womenSection() elif choice ==3: menSection() elif choice ==4: kidsSection() elif choice ==5: modifyItem() elif choice ==6: item=searchItem() if item: print("*******Record Found !!!*******") else: print("Record Not Found , Please Try Again !") elif choice ==7: showInventory() elif choice ==8: removeItem() elif choice ==9: allBills() elif choice == 10: generateBill() elif choice == 11:
21
print("Thanks for visitng THE MALL OF EMIRATESI \n ****We are eagerly waititng for your next visit !!! ***") break; else: print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ") else: print("\nERROR ESTABLISHING MYSQL CONNECTION !") # END OF THE PROJECT
22
Output of the Project Finally, we conclude our work and present the output of the Project.
MAIN SCREEN OF THE PROJECT
23
USER AUTHENTICATION SCREEN
24
NEW ITEM IN WOMEN’S SECTION
25
NEW ITEM IN MEN’S SECTION
26
NEW ITEM IN KIDS SECTION
27
WOMEN’S SECTION
28
MEN’S SECTION
29
KIDS SECTION
30
MODIFY ITEM
31
SEARCH ANY ITEM
32
SHOW ALL ITEMS AND TO DELETE ITEM
33
MAKING LIST OF ALL THE BILLS AND TO GENERATE CUSTOMER BILL
34
EXIT SCREEN
35
MYSQL DATABASE AND TABLES USED IN THIS PROJECTS
DATABASE AND TABLES
36
TABLE STRUCTURE
37
BACKEND DATA GENERATED THROUGH SOFTWARE
38
References
1. python.org
2. Code Academy
3. tutorialsPoint.com
4. PythonChallenge.com
5. Google’s Python Class
6. LearnPython.org
7. layak.in