package softspractice;
/**
* 我们在开发一个系统时需要对员工进行建模 员工包含三个属性
* 姓名 工号 工资 进行建模 员工包含 3 个属性
* 另外一个特殊属性:奖金属性 利用继承思想设计出员工类和经理类
* 要求类中提供必要的方法属性进行属性访问
*
* 员工类 name id pay
* 经理类 继承了员工,并有自己特有的bonus
**/
public class PracDemo {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
abstract class Employee{
private String name;
private String id;
private double pay;
Employee(String name,String id,double pay){
this.name = name;
this.id = id;
this.pay = pay;
}
public abstract void work();
}
class Mananger extends Employee{
private int bonus;
Mananger(String name, String id, double pay,int bonus) {
super(name, id, pay);
this.bonus = bonus;
// TODO Auto-generated constructor stub
}
public void work(){
System.out.println("manager work");
}
}
class Pro extends Employee{
Pro(String name, String id, double pay) {
super(name, id, pay);
// TODO Auto-generated constructor stub
}
public void work(){
System.out.println("Pro work");
}
}