23.实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty 和Staff。 具体要求如下: (1)Person类中的属性有:姓名name(String类型)...

//Person

package zuoye;

public class Person {
private String name,address,telphone,email;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public String getTelphone() {
return telphone;
}

public void setTelphone(String telphone) {
this.telphone = telphone;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

}

 

//Employee

package zuoye;

public class Employee extends Person {
private String office,hiredate;
private double wage;
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public String getHiredate() {
return hiredate;
}
public void setHiredate(String hiredate) {
this.hiredate = hiredate;
}
public double getWage() {
return wage;
}
public void setWage(double wage) {
this.wage = wage;
}

}

 

//Staff

package zuoye;

public class Staff extends Employee {
private String duty;

public String getDuty() {
return duty;
}

public void setDuty(String duty) {
this.duty = duty;
}

}

///Faculty

 

package zuoye;

public class Faculty extends Employee {
private String degree,level;

public String getDegree() {
return degree;
}

public void setDegree(String degree) {
this.degree = degree;
}

public String getLevel() {
return level;
}

public void setLevel(String level) {
this.level = level;
}

}

public void setDuty(String duty) {
this.duty = duty;
}

}

转载于:https://www.cnblogs.com/nicebaby/p/5892345.html

你可能感兴趣的:(23.实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty 和Staff。 具体要求如下: (1)Person类中的属性有:姓名name(String类型)...)