| /home/oracle/labs/06CollectionOperations/examples/EmployeeSearch/src/com/example/lambda/Bonus.java |
1
2 package com.example.lambda;
3
4
5
6 @author
7
8
9 public enum Bonus {
10
11 STAFF(0.02),
12 MANAGER(0.04),
13 EXECUTIVE(0.06);
14
15 private final double percent;
16
17 Bonus(double percent){
18 this.percent = percent;
19 }
20
21 public double percent(){
22 return percent;
23 }
24
25 public static double byRole(Role r){
26
27 double bonusPercent = 0.0d;
28
29 switch(r){
30 case EXECUTIVE: bonusPercent = EXECUTIVE.percent; break;
31 case MANAGER: bonusPercent = MANAGER.percent; break;
32 case STAFF: bonusPercent = STAFF.percent; break;
33 }
34
35 return bonusPercent;
36 }
37
38
39 }
40