class Employee: def __init__(self,id,name): self.id = id self.name = name # self.salary = salary def set_name(self): return self.name def get_name(self): return self.name def get_id(self): return self.id class Worker(Employee): def __init__(self,id,name): super().__init__(id,name) self.monthly = 0 self.work_hours = 0 self.hourly_pay = 0 def works(self,x): self.work_hours = x return self.work_hours def hourp(self,y): self.hourly_pay = y return self.hourly_pay def payroll(self): self.monthly = self.work_hours * self.hourly_pay return self.monthly w1 = Worker(1,'yyf') w1.works(50) w1.hourp(50) print(w1.payroll()) class Salesman(Employee): def __init__(self, id , name): # 初始化对象 super().__init__(id, name) self.monthly1 = 0
.编写一个简单的工资管理程序,系统可以管理以下四类人:工人(worker)、销售员(salesman)、经理(manager)、销售经理(salemanger)。 # 所有的员工都具有员工号,姓名,工
最新推荐文章于 2024-03-19 18:43:29 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)