首页 > 其他分享 >公司员工管理系统

公司员工管理系统

时间:2022-11-15 09:55:07浏览次数:45  
标签:__ 公司员工 管理系统 grade self init def name

class Employee:
        employeeNO = 20;#本公司职员编号目前最大值
        def __init__(self,name,grade):
            self.name = name#姓名
            self.grade = grade#级别
            Employee.employeeNO += 1
            self.individualEmpNo = Employee.employeeNO # 公司职工工号
            self.yx = 0.0 #月薪总额
        def promote(self,increment):
            self.grade += increment

class Manager(Employee):
    def __init__(self,name,grade): # 构造函数
        super(Manager,self).__init__(name,grade)
        self.mothlypay = 8000
    def pay(self):#计算月薪的方法
        self.yx = self.mothlypay
    def displayStatus(self):# 显示人员信息
        print("经理:",self.name,"工号:",self.individualEmpNo)
        print("级别:",self.grade,"月薪总额:",self.yx)

class Salesman(Employee):
    def __init__(self,name,grade,sales):
        super(Salesman,self).__init__(name,grade)
        self.commRate = 0.04#销售额提取百分比
        self.sales = sales#当月销售额
        self.mothlypay = 2000
    def pay(self):
        self.yx =self.mothlypay + self.sales * self.commRate
    def displayStatus(self):
        print("销售员:",self.name,"工号:",self.individualEmpNo)
        print("级别:",self.grade," 月薪总额:",self.yx)

class SalesManager(Employee):
    def __init__(self,name,grade,sales):
        super(SalesManager,self).__init__(name,grade)
        self.mothlypay = 5000
        self.commRate = 0.05
        self.sales = sales
    def pay(self):
        self.yx = self.sales * self.commRate + self.mothlypay
    def displayStatus(self):
        print("销售经理:",self.name,"工号:",self.individualEmpNo)
        print("级别:",self.grade," 月薪总额:",self.yx)

class jsy(Employee):    #技术人员
    def __init__(self,name,grade,hourlyRate,workHours):
        super(jsy,self).__init__(name,grade)
        self.hourlyRate = hourlyRate
        self.workHours = workHours
    def pay(self):
        self.yx = self.hourlyRate * self.workHours
    def displayStatus(self):
        print("技术人员:",self.name,"工号:",self.individualEmpNo)
        print("级别:",self.grade," 月薪总额:",self.yx)

def display(employee):
    employee.promote(2)
    employee.pay()
    employee.displayStatus()

a1 = Manager("小A",2)
b2 = Salesman("小B", 1, 10000)
c3 = SalesManager("小C", 1, 20000)
d4 = jsy("小D", 1, 200, 200)
display(a1)
display(b2)
display(c3)
display(d4)

标签:__,公司员工,管理系统,grade,self,init,def,name
From: https://www.cnblogs.com/jiyiran/p/16891427.html

相关文章