employee.java

来自「卡内基梅隆大学的网上教程 ssd3第二单元源码」· Java 代码 · 共 49 行

JAVA
49
字号
package unitTwo;

/**
 * This class models an Employee.
 *
 * @author author name
 * @version 1.0.0
 */
public class Employee extends Person  {

    /* Salary of the employee */
    private double salary;

    /**
     * Constructs an <code>Employee</code> object.
     *
     * @param initialName  the name of the employee.
     * @param initialAddress  the address of the employee.
     * @param initialSalary  the salary of the employee.
     */
    public Employee (String initialName, String initialAddress,
                     double initialSalary) {

        super(initialName, initialAddress);
        salary = initialSalary;
    }

    /**
     * Returns the salary of this employee.
     *
     * @return the salary of this employee.
     */
    public double getSalary() {

        return this.salary;
    }

    /**
     * Modifies the salary of this employee.
     *
     * @param newSalary  the new salary.
     */
    public void setSalary(double newSalary) {

        salary = newSalary;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?