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
1700472631
public void totalSalary(){
1700472632
1700472633
System.out.println(“本公司的月工资总额是”+(this.commonTotalSalary+
1700472634
1700472635
this.managerTotalSalary));
1700472636
1700472637
}
1700472638
1700472639
//访问普通员工,计算工资总额
1700472640
1700472641
public void visit(CommonEmployee commonEmployee){
1700472642
1700472643
this.commonTotalSalary=this.commonTotalSalary+commonEmployee.getSalary()
1700472644
1700472645
*COMMONEMPLOYEE_COEFFICIENT;
1700472646
1700472647
}
1700472648
1700472649
//访问部门经理,计算工资总额
1700472650
1700472651
public void visit(Manager manager){
1700472652
1700472653
this.managerTotalSalary=this.managerTotalSalary+manager.getSalary()
1700472654
1700472655
*MANAGER_COEFFICIENT;
1700472656
1700472657
}
1700472658
1700472659
}
[
上一页 ]
[ :1.70047261e+09 ]
[
下一页 ]