Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jackfrued
GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day31-35/code/example13.py
2928 views
1
from example12 import EmployeeFactory
2
3
4
def main():
5
"""主函数"""
6
emps = [
7
EmployeeFactory.create('M', '曹操'),
8
EmployeeFactory.create('P', '荀彧', 120),
9
EmployeeFactory.create('P', '郭嘉', 85),
10
EmployeeFactory.create('S', '典韦', 123000),
11
]
12
for emp in emps:
13
print('%s: %.2f元' % (emp.name, emp.get_salary()))
14
15
16
if __name__ == '__main__':
17
main()
18
19