Python-100-Days/Day16-20/code/example13.py

18 lines
419 B
Python

from example12 import EmployeeFactory
def main():
"""主函数"""
emps = [
EmployeeFactory.create('M', '曹操'),
EmployeeFactory.create('P', '荀彧', 120),
EmployeeFactory.create('P', '郭嘉', 85),
EmployeeFactory.create('S', '典韦', 123000),
]
for emp in emps:
print('%s: %.2f' % (emp.name, emp.get_salary()))
if __name__ == '__main__':
main()