-
Notifications
You must be signed in to change notification settings - Fork 0
/
#OOPR-Prac-11
79 lines (71 loc) · 2.87 KB
/
#OOPR-Prac-11
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
class Consultant:
def __init__(self,name,registered_company_list, vacancy_list, registered_student_dict):
self.__name = name
self.__registered_company_list = registered_company_list
self.__vacancy_list = vacancy_list
self.__registered_student_dict = registered_student_dict
def get_name(self):
return self.__name
def get_registered_company_list(self):
return self.__registered_company_list
def get_vacancy_list(self):
return self.__vacancy_list
def get_registered_student_dict(self):
return self.__registered_student_dict
def validate_vacancy(self,company_name):
if company_name in self.__registered_company_list:
index= self.__registered_company_list.index(company_name)
if self.__vacancy_list[index] > 0 :
return index
else:
return -1
else:
return -1
def register_student_for_placement (self,index,student_id):
if index != -1 :
x= self.__registered_company_list[index]
for key,value in self.__registered_student_dict.items():
if key== x:
self.__registered_student_dict[key].append(student_id)
self.__vacancy_list[index] -= 1
break
class Student:
def __init__(self,name,student_id,branch, aggregate_percentage,year_of_passing):
self.__name = name
self.__student_id =student_id
self.__branch = branch
self.__aggregate_percentage = aggregate_percentage
self.__year_of_passing = year_of_passing
def get_name(self):
return self.__name
def get_student_id(self):
return self.__student_id
def get_branch(self):
self.__branch
def get_aggregate_percentage(self):
self.__aggregate_percentage
def get_year_of_passing(self):
return self.__year_of_passing
def check_eligibility(self):
if self.__aggregate_percentage >= 65 :
if self.__year_of_passing == 2015:
return True
else:
return False
else:
return False
def apply_for_job(self,company_name,consultant):
index = consultant.validate_vacancy(company_name)
if index != -1 :
if self.check_eligibility():
student_id=self.__student_id
consultant.register_student_for_placement(index,student_id)
else:
return -1
else:
return -1
registered_student_dict= {"infosys":[123,345,346,230],"ibm":[],"accenture":[234,34,890],"wipro":[10,20]}
c=Consultant("Wehire",["infosys","wipro","ibm","accenture"],[5,9,7,8],registered_student_dict)
s=Student("sam","20","ece",64,2015)
print(s.check_eligibility())
print(s.apply_for_job("infosys",c))