实现一个名为Person的类和它的子类Employee,Employee有两个子类Faculty 和Staff。 具体要求如下: (1)Person类:姓名,地址,电话号码和电子邮件地址; (2)Employee类:办公室,工资 受雇日期(3)Faculty类:学位 级别(4)Staff类:职务

package b;

public class Person {
    private String name;
    private String address;
    private String telephone;
    private String 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 getTelephone() {
        return telephone;
    }
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    
    
}
package b;

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

}
package b;

public class Faculty extends Employee {
    private String degree;
    private String 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;
    }
    

}
package b;

public class Staff extends Employee {
    private String duty;

    public String getDuty() {
        return duty;
    }

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

public class Test1 {

    public static void main(String[] args) {
        Faculty ren=new Faculty();
        ren.setName("武松");
        ren.setAddress("景阳冈");
        ren.setTelephone("51451414");
        ren.setEmail("*****@163.com");
        ren.setOffice("413室");
        ren.setWage(5000.0);
        ren.setHiredate("2016.5.11");
        ren.setDegree("学士");
        ren.setLevel("99");
        Staff ren1=new Staff();
        ren1.setDuty("打虎英雄");
        System.out.println("姓名:\t"+ren.getName());
        System.out.println("地址:\t"+ren.getAddress());
        System.out.println("电话:\t"+ren.getTelephone());
        System.out.println("油箱:\t"+ren.getEmail());
        System.out.println("办公室:\t"+ren.getOffice());
        System.out.println("工资:\t"+ren.getWage());
        System.out.println("受雇日期: \t"+ren.getHiredate());
        System.out.println("学位:\t"+ren.getDegree());
        System.out.println("等级:\t"+ren.getLevel());    
        System.out.println("职务: \t"+ren1.getDuty());
        
        
    }

}

posted @ 2016-05-23 11:57  凌零聆  阅读(4056)  评论(0编辑  收藏  举报