打字猴:1.700472581e+09
1700472581 private String getBasicInfo(Employee employee){
1700472582
1700472583 String info=“姓名:”+employee.getName()+”\t”;
1700472584
1700472585 info=info+“性别:”+(employee.getSex()==Employee.FEMALE?“女”:“男
1700472586
1700472587 “)+”\t”;
1700472588
1700472589 info=info+“薪水:”+employee.getSalary()+”\t”;
1700472590
1700472591 return info;
1700472592
1700472593 }
1700472594
1700472595 }
1700472596
1700472597 汇总表实现数据汇总功能,其接口如代码清单25-22所示。
1700472598
1700472599 代码清单25-22 汇总表接口
1700472600
1700472601 public interface ITotalVisitor extends IVisitor{
1700472602
1700472603 //统计所有员工工资总和
1700472604
1700472605 public void totalSalary();
1700472606
1700472607 }
1700472608
1700472609 就一句话,非常简单,我们再来看具体的汇总表访问者,如代码清单25-23所示。
1700472610
1700472611 代码清单25-23 具体汇总表
1700472612
1700472613 public class TotalVisitor implements ITotalVisitor{
1700472614
1700472615 //部门经理的工资系数是5
1700472616
1700472617 private final static int MANAGER_COEFFICIENT=5;
1700472618
1700472619 //员工的工资系数是2
1700472620
1700472621 private final static int COMMONEMPLOYEE_COEFFICIENT=2;
1700472622
1700472623 //普通员工的工资总和
1700472624
1700472625 private int commonTotalSalary=0;
1700472626
1700472627 //部门经理的工资总和
1700472628
1700472629 private int managerTotalSalary=0;
1700472630
[ 上一页 ]  [ :1.700472581e+09 ]  [ 下一页 ]