class Employee: def __init__(self, name, address, employee_number): self.name = name self.__address = address self.__emp_num = employee_number def get_address(self): return self.__address def set_address(self, address): #TODO in later version: validate address self.__address = address def get_number(self): return self.__emp_num def __eq__(self, other): return self.__emp_num == other.__emp_num def __str__(self): return self.name class Company: def __init__(self, name, address, employee_count, employees): self.name = name self.__address = address self.__employee_count = employee_count self.__employees = employees def get_address(self): return self.__address def set_address(self, address): #TODO in later version: validate address self.__address = address def get_employee_count(self): return self.__employee_count def set_employee_count(self, count): if not isinstance(count, int): raise TypeError('Employee count must be a positive integer.') elif count < 0: raise ValueError('Employee count must be a positive integer.') self.__employee_count = count def add_employee(self, employee): if not isinstance(employee, Employee): raise TypeError('Wrong type') self.__employees.append(employee) def remove_employee(self, employee): self.__employees.remove(employee) def get_employees(self): return self.__employees def split(self, new_company_name): ''' This method is used when a company is split into two companies. new_company_name represents the name of the new company (the one returned by this method. All other changes to the companies will need to be done after the split, using the appropriate methods. ''' return Company(new_company_name, self.__address, self.__employee_count, self.__employees) def merge(self, other_company): ''' This method merges two companies and modifies this company to reflect those changes. This company keeps its name and address, so if those need to be changed, use the appropriate methods. ''' self.__employee_count += other_company.__employee_count self.__employees += other_company.__employees