-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParttimeEmployee.java
More file actions
49 lines (39 loc) · 1.04 KB
/
ParttimeEmployee.java
File metadata and controls
49 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package designpattern.behavioral_pattern.visitor.v1;
/**
* <p>Description: 兼职员工类:具体元素类</p>
*
* @author Cui Kaihui
* @date 2019/6/27 22:19
*/
public class ParttimeEmployee implements Employee {
private String name;
private double hourWage;
private int workTime;
public ParttimeEmployee(String name, double hourWage, int workTime) {
this.name = name;
this.hourWage = hourWage;
this.workTime = workTime;
}
public void setName(String name) {
this.name = name;
}
public void setHourWage(double hourWage) {
this.hourWage = hourWage;
}
public void setWorkTime(int workTime) {
this.workTime = workTime;
}
public String getName() {
return (this.name);
}
public double getHourWage() {
return (this.hourWage);
}
public int getWorkTime() {
return (this.workTime);
}
@Override
public void accept(Department handler) {
handler.visit(this); //调用访问者的访问方法
}
}