abstract class Employee{ //员工抽象类 public String name; //姓名 public Employee(){} public Employee(String name){ //有参构造 super(); this.name=name; } public String getName() { return name; } public void setName(String name) { this.name = name; } abstract double earning(); //返回工资的方法 返回的是小数类型 public String getInfo(){ return "姓名:"+name+",总工资:"+earning(); } } class SalaryEmployee extends Employee{ public double salary; //工资 public int workingDays; //工作天数 public double offDays; //请假天数 public SalaryEmployee(){super();} public SalaryEmployee(String name,double salary,int workingDays,double offDays){ super(name); this.salary=salary; this.workingDays=workingDays; this.offDays=offDays; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } pub
计算工资的方法
最新推荐文章于 2024-09-04 15:29:36 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)