一、java编写一个雇员类:1.属性:员工编号,姓名,职位,工资,2.方法包括:输出基本信息,计算
一、java编写一个雇员类:1.属性:员工编号,姓名,职位,工资,2.方法包括:输出基本信息,计算年薪,二、在雇员累基础上构造销售人员类:1.属性:…,奖金,2.方法:重...
一、java编写一个雇员类:1.属性:员工编号,姓名,职位,工资,2.方法包括:输出基本信息,计算年薪, 二、在雇员累基础上构造销售人员类:1.属性:…,奖金,2.方法:重写输出基本信息方法和计算年薪方法, 三.要求属性全部封装;方法全部外部调用,类内不能使用sysout,至少两个构造方法。
展开
展开全部
class Worker {
private String no;
private String name;
private String job;
private double wages;
public Worker() {
super();
}
public Worker(String no, String name, String job, double wages) {
super();
this.no = no;
this.name = name;
this.job = job;
this.wages = wages;
}
public String getWorkerInfo() {
return "员工编号:" + no + ";姓名:" + name + ";职位:" + job + ";工资:" + wages;
}
public double getPackage() {
return wages * 12;
}
}
class Salesman extends Worker {
private double bonus;
public Salesman() {
super();
}
public Salesman(double bonus) {
super();
this.bonus = bonus;
}
@Override
public String getWorkerInfo() {
return super.getWorkerInfo() + ";奖金:" + bonus;
}
@Override
public double getPackage() {
return super.getPackage() + bonus;
}
}
private String no;
private String name;
private String job;
private double wages;
public Worker() {
super();
}
public Worker(String no, String name, String job, double wages) {
super();
this.no = no;
this.name = name;
this.job = job;
this.wages = wages;
}
public String getWorkerInfo() {
return "员工编号:" + no + ";姓名:" + name + ";职位:" + job + ";工资:" + wages;
}
public double getPackage() {
return wages * 12;
}
}
class Salesman extends Worker {
private double bonus;
public Salesman() {
super();
}
public Salesman(double bonus) {
super();
this.bonus = bonus;
}
@Override
public String getWorkerInfo() {
return super.getWorkerInfo() + ";奖金:" + bonus;
}
@Override
public double getPackage() {
return super.getPackage() + bonus;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询