打字猴:1.700472434e+09
1700472434
1700472435 public class Visitor implements IVisitor{
1700472436
1700472437 //部门经理的工资系数是5
1700472438
1700472439 private final static int MANAGER_COEFFICIENT=5;
1700472440
1700472441 //员工的工资系数是2
1700472442
1700472443 private final static int COMMONEMPLOYEE_COEFFICIENT=2;
1700472444
1700472445 //普通员工的工资总和
1700472446
1700472447 private int commonTotalSalary=0;
1700472448
1700472449 //部门经理的工资总和
1700472450
1700472451 private int managerTotalSalary=0;
1700472452
1700472453 //计算部门经理的工资总和
1700472454
1700472455 private void calManagerSalary(int salary){
1700472456
1700472457 this.managerTotalSalary=this.managerTotalSalary+salary
1700472458
1700472459 *MANAGER_COEFFICIENT;
1700472460
1700472461 }
1700472462
1700472463 //计算普通员工的工资总和
1700472464
1700472465 private void calCommonSlary(int salary){
1700472466
1700472467 this.commonTotalSalary=this.commonTotalSalary+
1700472468
1700472469 salary*COMMONEMPLOYEE_COEFFICIENT;
1700472470
1700472471 }
1700472472
1700472473 //获得所有员工的工资总和
1700472474
1700472475 public int getTotalSalary(){
1700472476
1700472477 return this.commonTotalSalary+this.managerTotalSalary;
1700472478
1700472479 }
1700472480
1700472481 }
1700472482
1700472483 员工和经理层的信息就不再展示了,请参考代码清单25-6。程序还是比较简单的,分别计算普通员工和经理级员工的工资总和,然后加起来。注意,我们在实现时已经考虑员工工资和经理工资的系数不同。
[ 上一页 ]  [ :1.700472434e+09 ]  [ 下一页 ]