打字猴:1.700471893e+09
1700471893 return info;
1700471894
1700471895 }
1700471896
1700471897 //组装出部门经理的信息
1700471898
1700471899 private String getManagerInfo(Manager manager){
1700471900
1700471901 String basicInfo=this.getBasicInfo(manager);
1700471902
1700471903 String otherInfo=“业绩:”+manager.getPerformance()+”\t”;
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
[ 上一页 ]  [ :1.700471893e+09 ]  [ 下一页 ]