码迷,mamicode.com
首页 > 其他好文 > 详细

23.实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty 和Staff。 具体要求如下: (1)Person类中的属性有:姓名name(String类型),地址address(String类型), 电话号码telphone(String类型)和电子邮件地址email(String类型); (2)Employee类中的属性有:办公室office(Stri

时间:2016-09-21 14:29:34      阅读:740      评论:0      收藏:0      [点我收藏+]

标签:

//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;
}

}

23.实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty 和Staff。 具体要求如下: (1)Person类中的属性有:姓名name(String类型),地址address(String类型), 电话号码telphone(String类型)和电子邮件地址email(String类型); (2)Employee类中的属性有:办公室office(Stri

标签:

原文地址:http://www.cnblogs.com/nicebaby/p/5892345.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!