JAVA|实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty和Staff

实现一个名为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;
    }
}

  • 14
    点赞
  • 86
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值