1.程序要求
2.程序实现
-
1,绘制类图
-
2,编写代码
"""
日期: Sun Mar 20 07:36:51 2022
功能: 编程练习 1.5.5
作者: 小梁aixj
"""
class People:
def __init__(self, name="小梁aixj", age=18, sex="男"):
self.name = name
self.age = age
self.sex = sex
def show(self):
print("姓名:{}\n年龄:{}\n性别:{}\n".format(self.name, self.age, self.sex))
class Mag(People):
def __init__(self, year="20万", off="经理"):
print("年薪:{}\n职位:{}\n".format(year, off))
class Off(People):
def __init__(self, department="销售部", month="4000"):
print("所属部门:{}\n月薪:{}\n".format(department, month))
per = People()
per.show()
Mag()
Off()