-
Notifications
You must be signed in to change notification settings - Fork 1
/
pavan2.py
358 lines (325 loc) · 12.9 KB
/
pavan2.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
class student(object):
"""
This is the class for Storing Student information
"""
Branch = 'IT' #Static Variable of Branch
clg = 'MIT Alandi' #static variable of college
stream = 'Engineering' #static variable of stream
no_of_stud = 0 #variable to count number of student
def __init__(self,prn,rol,name,surname,contact):
self.__prn = prn
self.__rol = rol
self.__name = name
self.__surname = surname
self.__contact = contact
student.no_of_stud += 1
def display(self):
print("\n")
print(self.prn)
print(self.rol)
print(self.name)
print(self.surname)
print(self.contact)
print("\n")
@property
def prn(self):
return self.__prn
@prn.setter
def prn(self,prn):
self.__prn = prn
@property
def rol(self):
return self.__rol
@rol.setter
def rol(self,rol):
self.__rol = rol
@property
def name(self):
return self.__name
@name.setter
def name(self,name):
self.__name = name
@property
def surname(self):
return self.__surname
@surname.setter
def surname(self,surname):
self.__surname = surname
@property
def contact(self):
return self.__contact
@contact.setter
def contact(self,contact):
self.__contact = contact
list1=[]
@staticmethod
def add():
n = input("\nHey User How Many student You Should Add : ")
choice2 = 1
choice3 = 2
choice4 = 3
choice5 = 4
choice6 = 5
for i in range(n):
choice2 = 1
while choice2 == 1:
print('Number Of Student : '+str(i+1))
prn = raw_input("PRN:--")
if prn == "":
print("\n")
print("enter something..")
print("\n")
elif prn.isalpha():
print("\n")
print("Enter Number only")
print("\n")
else:
choice2 = 0
choice2 = 1
while choice2 == 1:
rol = raw_input("Roll no:--")
if rol == "":
print("\n")
print("enter something..")
print("\n")
elif rol.isalpha():
print("\n")
print("Enter Number only")
print("\n")
else:
choice2 = 0
choice3 = 2
while choice3 == 2:
name = raw_input('NAME : ')
if name == "":
print("\n")
print("enter something")
print("\n")
elif name.isdigit():
print("\n")
print("Enter the Name only.")
print("\n")
else:
choice3 = 1
choice4 = 3
while choice4 == 3:
surname = raw_input('SURNAME : ')
if surname == "":
print("\n")
print("enter something")
print("\n")
elif surname.isdigit():
print("\n")
print("Enter name only")
print("\n")
else:
choice4 = 2
choice6 = 5
while choice6 == 5:
contact =raw_input('Contact:-')
if contact == "":
print("\n")
print "Enter something"
print("\n")
elif len(contact) != 10:
print("\n")
print("enter valid number")
print("\n")
elif contact.isalpha():
print("\n")
print("enter the Valid Input")
print("\n")
else:
choice6 = 4
student.list1.append(student(prn,rol,name,surname,contact))
@staticmethod
def delete():
print("\n")
print("1.Delete By PRN:-- ")
print ("2.Delete By Roll Number:--")
print("3. Delete By Name:--")
print("4.Delete By Surname")
print("5.Delete By COntact")
choice = input("Enter Your Choice:--")
if choice == 1:
dele = raw_input("Enter the PRN: ")
for obj in student.list1:
if obj.prn == dele:
student.list1.remove(obj)
elif choice == 2:
dele = raw_input("Enter the Roll Number: ")
for obj in student.list1:
if obj.prn == dele:
student.list1.remove(obj)
elif choice == 3:
dele = raw_input(" Enter the Name of Student: ")
for obj in student.list1:
if obj.name == dele:
student.list1.remove(obj)
elif choice == 4:
dele = raw_input(" Enter the Surname of Student: ")
for obj in student.list1:
if obj.surname == dele:
student.list1.remove(obj)
elif choice == 5:
dele = raw_input(" Enter the Contact number of Student: ")
for obj in student.list1:
if obj.contact == dele:
student.list1.remove(obj)
@staticmethod
def show():
print("\n")
print("MIT AOE Student DataBase ")
for i in student.list1:
print("______________________")
print("Prn :-- " +i.prn)
print "Roll Number :--",i.rol
print("Name:-- " +i.name)
print("Surname:-- " +i.surname )
print ("Branch:--" +i.Branch)
print("contact:-- " +i.contact)
print("College :-- " +i.clg)
print("Stream :-- " +i.stream)
print("\n")
print("total number of student is:--")
print (student.no_of_stud)
print("______________________")
@staticmethod
def search():
choices= 0
print("\n")
print("1.Search By Name")
print("2.Search by prn")
print("3.Search by Surname")
print("4.Search By Contact")
print("\n")
Searchchoice= input("Enter your Option:---")
if Searchchoice == 1:
names=raw_input("Enter the name of Student :---")
for i in student.list1 :
if i.name == names :
print("______________________")
print("\n Prn :-- " +i.prn)
print("Name:-- " +i.name)
print(" Surname:-- " +i.surname )
print ("Branch:--" +i.stream)
print("contact:-- " +i.contact)
print("total number of student is:--")
print (student.no_of_stud)
print("______________________")
if Searchchoice == 3:
surnames = raw_input("Enter your surname:--")
for i in student.list1:
if i.surname == surnames:
print("______________________")
print("\n Prn :-- " +i.prn)
print("Name:-- " +i.name)
print(" Surname:-- " +i.surname )
print ("Branch:--" +i.stream)
print("contact:-- " +i.contact)
print("total number of student is:--")
print (student.no_of_stud)
print("______________________")
if Searchchoice == 2:
prns = raw_input("Enter your Prn:--")
for i in student.list1:
if i.prn == prns:
print("______________________")
print("\n Prn :-- " +i.prn)
print("Name:-- " +i.name)
print(" Surname:-- " +i.surname )
print ("Branch:--" +i.stream)
print("contact:-- " +i.contact)
print("total number of student is:--")
print (student.no_of_stud)
print("______________________")
if Searchchoice == 4:
contacts = raw_input("Enter your Contact:--")
for i in student.list1:
if i.contact == contacts:
print("______________________")
print("\n Prn :-- " +i.prn)
print("Name:-- " +i.name)
print(" Surname:-- " +i.surname )
print ("Branch:--" +i.stream)
print("contact:-- " +i.contact)
print("total number of student is:--")
print (student.no_of_stud)
print("______________________")
@staticmethod
def update():
upchoice = 0
updatestudent = raw_input(" Enter the PRN of student to update :- ")
for i in student.list1:
if i.prn == updatestudent:
print("1.PRN")
print("2.Name")
print("3.Surname")
print("4.Contact")
uchoice = input("\nEnter your choice:- ")
if uchoice == 1:
uprn = raw_input("Enter New prn:- ")
i.prn = uprn
elif uchoice == 2:
nameu = raw_input("Enter New name:- ")
i.name = nameu
elif uchoice == 3:
surnameu = raw_input("Enter New Surname:- ")
i.surname = surnameu
elif uchoice == 4 :
contactu = raw_input("Enter New contact:- ")
i.contact = contactu
@staticmethod
def exit():
print ("Thanks for visiting MIT AOE Database System Visit Again")
@staticmethod
def depart():
print "Branch Of Student is",student.Branch
@staticmethod
def clag():
print "College of student is:---",student.clg
@staticmethod
def stram():
print "Stream Of Student :--",student.stream
n = student
p = 0
print (student.__doc__)
while p == 0:
print("\n")
print("\n_______________________________________________________________________________________________________________ \n \n* WELCOME TO MIT ACADEMY OF ENGINNERING INFORMATION TECHNOLOGY STUDENT MANAGEMENT DATABASE SYSTEM * \n\n1.INSERT \n2.DELETE \n3.SEARCH \n4.UPDATE \n5.DISPLAY ALL STUDENT DATA \n6.QUIT \n_________________________________________________________________________________________________________________")
chq = 1
while chq == 1:
choice = raw_input("Enter your choice:--")
if choice== "":
print("\n")
print("enter something..")
print("\n")
elif choice.isalpha():
print("\n")
print("Enter only Number")
print("\n")
elif int(choice) < 0 :
print("Enter Positive Number")
else:
ch = int(choice)
chq = 0
if ch == 1:
n.add()
elif ch == 2:
n.delete()
elif ch == 3:
n.search()
elif ch == 4:
n.update()
elif ch == 5:
n.show()
elif ch == 7: #to find The Branch of Student
n.depart()
elif ch == 8: #to Find the College of Student
n.clag()
elif ch == 9: #to Find the Stream of Student
n.stram()
else:
p = 1
if ch == 6:
n.exit()