要求:不同类型的雇员按不同的方式支付工资:经理(Manager)每月获得一份固定的工资;销售人员(Salesman)在基本工资的基础上每月还按销售提成;一般工人(Worker)则按他每月工作的天数计算工资。
实现该工资支付程序的相关类的定义。并编写一个演示程序演示这些类的功能
本人很急.下周就要交~

解决方案 »

  1.   

    设计一个员工类(Employee),定义工资和其他属性,经理类(Manager) 、销售人员(Sale三man)和一般工人(Worker)都继承员工类,然后分别重载(Override)计算工资的方法
      

  2.   

    xiexie !还有人帮我么~~~谢谢你们了
      

  3.   

    abstract class Employee {
    public final static int MANAGER = 0;
    public final static int SALES_MAN = 1;
    public final static int NORMAL_EMPLOYEE = 2;
    public final static int ACCOUNTANT = 3;
    public final static int OTHER = 4;
    protected int type;
    public Employee() {
    type = NORMAL_EMPLOYEE;
    }
    public Employee(int type) {
    this.type = type;
    }
    public int getEmployeeType() {
    return type;
    }}
    class Manager extends Employee {
    public Manager() {
    super(MANAGER);
    }
    }
    interface SalesManInterface {
    public int getSalesAmount();
    }
    class SalesMan extends Employee implements SalesManInterface{
    public SalesMan() {
    super(SALES_MAN);
    } public int getSalesAmount() {
    return -1;
    }

    }
    interface NormalEmployeeInterface {
    public int getWorkDayAmount();
    }
    class NormalEmployee extends Employee implements NormalEmployeeInterface {
    public NormalEmployee() {
    } public int getWorkDayAmount() {
    return -1;
    }

    }