小编Tki*_*ter的帖子

运行python程序后没有输出

我应该编写一个名为Employee的类,它包含名称,工资和服务年限的数据.它计算员工在退休时将获得的每月养老金支出,并显示Employee对象的三个实例变量.它还调用Employee对象的养老金方法来计算该员工的每月养老金支出并显示它.

运行我的程序后我没有得到任何输出,这是具体问题.

我应该得到这样的东西作为输出:

Name: Joe Chen
Salary: 80000
Years of service: 30
Monthly pension payout: 3600.0

Process finished with exit code 0
Run Code Online (Sandbox Code Playgroud)

这是完整的代码.

class Employee:


    # init method implementation
    def __init__(self, EmpName, EmpSalary, EmpYos):
        self.EmpName = EmpName
        self.EmpSalary = EmpSalary
        self.EmpYos = EmpYos

    def displayEmployeeDetails(self):
        print "\nName ", self.EmpName,

    # defines the salary details
    def displaySalary(self):
        print "\nSalary", self.EmpSalary

    # defines the years of service
    def displayYoservice(self):
        print "\nYears of Service", self.EmpYos

    # defines pension
    def MonthlypensionPayout(self):
        print "\nMonthly Pension …
Run Code Online (Sandbox Code Playgroud)

python class python-2.x

3
推荐指数
1
解决办法
133
查看次数

标签 统计

class ×1

python ×1

python-2.x ×1