package jicheng;
abstract class Employee{
private String name;
private int id;
private int wage;
public abstract void work();
public abstract void getFullWage();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getWage() {
return wage;
}
public void setWage(int wage) {
this.wage = wage;
}
Employee(){
}
Employee(String name,int id,int wage){
this.id = id;
this.name = name;
this.wage = wage;
}
}
class Manager extends Employee{
int reward;
Manager(){
}
Manager(String name,int id,int wage,int reward){
super(name,id,wage);
this.reward = reward;
}
@Override
public void work() {
// TODO Auto-generated method stub
System.out.println(super.getName()+"经理在认真工作");
}
@Override
public void getFullWage() {
// TODO Auto-generated method stub
System.out.println(super.getName()+"经理的奖金是"+reward+",他的总工资是"+(super.getWage()+reward));
}
}
class Commoner extends Employee{
Commoner(){
}
Commoner(String name,int id,int wage){
super(name,id,wage);
}
@Override
public void work() {
// TODO Auto-generated method stub
System.out.println(super.getName()+"这个普通员工在认真工作");
}
@Override
public void getFullWage() {
// TODO Auto-generated method stub
System.out.println(super.getName()+"普通员工的工资是"+super.getWage());
}
}
public class testjinli {
public static void main(String[] args) {
Manager m = new Manager("张三",25,5000,8000);
m.work();
m.getFullWage();
Commoner t = new Commoner("李四",25,5000);
t.work();
t.getFullWage();
}
}