Пример #1
0
importlib.reload(sys.modules['hr'])
importlib.reload(sys.modules['productivity'])
importlib.reload(sys.modules['employees'])


def print_dict(d):
    print(json.dumps(d, indent=2))


# ------------------------------------------------
# Factory method: assign singleton classes
# ------------------------------------------------
employee_ls = employee_database.employees

track(employee_ls, 40)
calculate_payroll2(employee_ls)

Employee(1)
Employee.__mro__
# Employee(1).

# dir(Employee)
temp_secretary = Employee(5)
print('Temporary Secretary:')
print_dict(temp_secretary.to_dict())

sales_employee = employee_ls[2]
ltd_policy = LTDPolicy()

# Apply existing policy to new policy (ltd_policy) and then set
Пример #2
0
# manager = employees[0]
# manager.payroll = HourlyPolicy(55)
# productivity_system.track(employees, 40)
# payroll_system.calculate_payroll(employees)
#
# em = Employee(1, 2, 3, 4, 5)

import json

from hr import calculate_payroll, LTDPolicy
from productivity import track
from employees import employee_database, Employee


def print_dict(d):
    print(json.dumps(d, indent=2))


employees = employee_database.employees

sales_employee = employees[2]
ltd_policy = LTDPolicy()
sales_employee.apply_payroll_policy(ltd_policy)

track(employees, 40)
calculate_payroll(employees)

temp_secretary = Employee(5)
print('Temporary Secretary:')
print_dict(temp_secretary.to_dict())
Пример #3
0
"""Office control center."""
import json
from hr import calculate_payroll, DisabilityPolicy
from employees import employee_database, Employee
from productivity import track


def print_dictionary(employee_as_dict):
    """Print a dictionary representation of the employee."""
    print(json.dumps(employee_as_dict, indent=2))

employees = employee_database.employees()

sales_employee = employees[2]
disability = DisabilityPolicy()
sales_employee.apply_payroll_policy(disability)

track(employees, 35)
calculate_payroll(employees)

temp_secretary = Employee(5)
print('Temporary Secretary:')
print_dictionary(temp_secretary.to_dict())