标签:
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()); } }
标签:
原文地址:http://www.cnblogs.com/wenwen123/p/5519447.html