打字猴:1.700471904e+09
1700471904
1700471905 return basicInfo+otherInfo;
1700471906
1700471907 }
1700471908
1700471909 //组装出普通员工信息
1700471910
1700471911 private String getCommonEmployee(CommonEmployee commonEmployee){
1700471912
1700471913 String basicInfo=this.getBasicInfo(commonEmployee);
1700471914
1700471915 String otherInfo=“工作:”+commonEmployee.getJob()+”\t”;
1700471916
1700471917 return basicInfo+otherInfo;
1700471918
1700471919 }
1700471920
1700471921 }
1700471922
1700471923 在具体的实现类中,定义了两个私有方法,作用就是产生需要打印的数据和格式,然后在访问者访问相关的对象时产生这个报表。抽象员工Employee稍有修改,如代码清单25-7所示。
1700471924
1700471925 代码清单25-7 抽象员工类
1700471926
1700471927 public abstract class Employee{
1700471928
1700471929 public final static int MALE=0;//0代表是男性
1700471930
1700471931 public final static int FEMALE=1;//1代表是女性
1700471932
1700471933 //甭管是谁,都有工资
1700471934
1700471935 private String name;
1700471936
1700471937 //只要是员工那就有薪水
1700471938
1700471939 private int salary;
1700471940
1700471941 //性别很重要
1700471942
1700471943 private int sex;
1700471944
1700471945 //以下是简单的getter/setter
1700471946
1700471947 public String getName(){
1700471948
1700471949 return name;
1700471950
1700471951 }
1700471952
1700471953 public void setName(String name){
[ 上一页 ]  [ :1.700471904e+09 ]  [ 下一页 ]