Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Employee:
- def __init__(self, i_num, fname, lname, work_experience, education_level, salary, age):
- self.i_num = i_num
- self.fname = fname
- self.lname = lname
- self.work_experience = work_experience
- self.education_level = education_level
- self.salary = salary
- self.age = age
- def display_info(self):
- print(f"Служебен номер: {self.i_num}")
- print(f"Име: {self.fname}")
- print(f"Фамилия: {self.lname}")
- print(f"Трудов стаж: {self.work_experience}")
- print(f"Образование: {self.education_level}")
- print(f"Заплата: {self.salary}")
- print(f"Възраст: {self.age}")
- def bonus(self):
- bonus = 0
- if self.education_level == "Висше":
- bonus += 5
- elif self.education_level == "Средно":
- bonus += 2
- bonus += 1.2 * self.work_experience
- return self.salary * (bonus / 100)
- def sort_employee(employee_list):
- sorted_employees = sorted(employee_list, key=lambda x: x.age)
- for employee in sorted_employees:
- employee.display_info()
- def search_by_name(employee_list, name, lname):
- found = False
- for employee in employee_list:
- if employee.fname == name and employee.lname == lname:
- employee.display_info()
- found = True
- break
- if not found:
- print("Not found!!!")
- def print_by_education_experience(employee_list, education, experience):
- for employee in employee_list:
- if employee.education_level == education and employee.work_experience == experience:
- employee.display_info()
- def remove_employee(employee_list, i_num):
- for employee in employee_list:
- if employee.i_num == i_num:
- employee_list.remove(employee)
- print("Information deleted!!!")
- break
- else:
- print("Wrong i_num!!!")
- n = int(input("Въведете броят на служителите: "))
- employee_list = []
- for _ in range(n):
- i_num = int(input())
- fname = input()
- lname = input()
- work_experience = int(input())
- education_level = input()
- salary = int(input())
- age = int(input())
- employee = Employee(i_num, fname, lname, work_experience, education_level, salary, age)
- employee_list.append(employee)
- while True:
- choice = int(input("Изберете опция от 1 до 5: "))
- match choice:
- case 1:
- sort_employee(employee_list)
- case 2:
- name = input()
- lname = input()
- search_by_name(employee_list, name, lname)
- case 3:
- education = input()
- experience = int(input())
- print_by_education_experience(employee_list, education, experience)
- case 4:
- i_num = int(input())
- remove_employee(employee_list, i_num)
- print(employee_list)
- case 5:
- break
- case _:
- print("Няма такава опция!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement