-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodule2.1.py
104 lines (77 loc) · 3.61 KB
/
module2.1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import queue
class Node:
def __init__(self, data = {}):
self.data = data
self.next = None
class Queue:
def __init__(self):
self.head = None
self.last = None
def enqueue(self, data):
if self.last is None:
self.head = Node(data)
self.last = self.head
else:
self.last.next = Node(data)
self.last = self.last.next
def dequeue(self):
if self.head is None:
return None
else:
to_return = self.head.data
self.head = self.head.next
return to_return
def display(self):
printval = self.head
while printval is not None:
print("--------------------------------------------------")
print("DAY ==> ",printval.data.get("DAY"))
print("Customer name is ==> ",printval.data.get("NAME"))
print("Customer address is ==> ",printval.data.get("ADDRESS"))
print("Customer age is ==> ",printval.data.get("AGE"))
print("Customer mobile no is ==> ",printval.data.get("MOBILE_NO"))
print("Customer email is ==> ",printval.data.get("EMAIL"))
printval = printval.next
return
def search(self):
cust=input("The day on which customer you want to see ==> ")
printval = self.head
while printval is not None:
if(printval.data.get("DAY")==cust):
print("Found")
print("--------------------------------------------------")
print("Customer name is ==> ",printval.data.get("NAME"))
print("Customer address is ==> ",printval.data.get("ADDRESS"))
print("Customer age is ==> ",printval.data.get("AGE"))
print("Customer mobile no is ==> ",printval.data.get("MOBILE_NO"))
print("Customer email is ==> ",printval.data.get("EMAIL"))
return
printval = printval.next
a_stack = Queue()
choice = 0
while True:
print("\n_________________________________________MENU FOR CUSTOMER MANAGEMENT IN RESTAURANT __________________________________________ \n\n\t\t\t\t\t1.Add Customer \n\t\t\t\t\t2.Delete Customer \n\t\t\t\t\t3.Show all Customers \n\t\t\t\t\t4.Search Customer \n\t\t\t\t\t5.Exit\n")
choice = input("\nEnter your choice==> ")
if (choice == "1"):
print("------------------------------------------------------------------")
day = input("\nEnter the Day ==> ")
name = input("\nEnter the Name of the Customers ==> ")
address = input("\nEnter the Address of the Customers ==> ")
age = input("\nEnter the Age of the Customers ==> ")
mobile_no = input("\nEnter the Mobile No of the Customers ==> ")
email = input("\nEnter the Email of the Customers ==> ")
print("------------------------------------------------------------------")
data = {"DAY":day,"NAME":name,"ADDRESS":address,"AGE":age,"MOBILE_NO":mobile_no,"EMAIL":email}
a_stack.enqueue(data)
elif(choice == "2"):
dequeued = a_stack.dequeue()
if dequeued is None:
print('Queue is empty.')
else:
print('Dequeued element: ',dequeued)
elif(choice == "3"):
a_stack.display()
elif(choice == "4"):
a_stack.search()
elif(choice == "5"):
break