实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty和Staff
具体要求如下:
(1)Person类中的属性有:姓名name(String类型),地址address(String类型),电话号码telphone(String类型)和电子邮件地址email(String类型);
(2)Employee类中的属性有:办公室office(String类型),工资wage(double类型),受雇日期hiredate(String类型);
(3)Faculty类中的属性有:学位degree(String类型),级别level(String类型);
(4)Staff类中的属性有:职务称号duty(String类型)。
Person.java👇
package work.sixth;
public class Person {
protected String name;
protected String address;
protected String telephone;
protected String email;
public Person(String name, String address, String telephone, String email) {
this.name = name;
this.address = address;
this.telephone = telephone;
this.email = email;
}
}
Employee.java👇
package work.sixth;
public class Employee extends Person {
protected String office;
protected double wage;
protected String hiredate;
public Employee(String name, String address, String telephone, String email, String office, double wage, String hiredate) {
super(name, address, telephone, email);
this.office = office;
this.wage = wage;
this.hiredate = hiredate;
}
}
Faculty.java👇
package work.sixth;
public class Faculty extends Employee {
private String degree;
private String level;
public Faculty(String name, String address, String telephone, String email, String office, double wage, String hiredate, String degree, String level) {
super(name, address, telephone, email, office, wage, hiredate);
this.degree = degree;
this.level = level;
}
}
Staff.java👇
package work.sixth;
public class Staff extends Employee {
private String duty;
public Staff(String name, String address, String telephone, String email, String office, double wage, String hiredate, String duty) {
super(name, address, telephone, email, office, wage, hiredate);
this.duty = duty;
}
}