-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskLog.java
More file actions
44 lines (36 loc) · 1.07 KB
/
TaskLog.java
File metadata and controls
44 lines (36 loc) · 1.07 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
package TaskManagerProject;
import java.time.LocalDateTime;
import java.time.Duration;
//TASK Log (time spent by employee on a task)
public class TaskLog
{
private LocalDateTime fromTime;
private LocalDateTime toTime;
//Connecting the "TaskLog" with the other classes, Employee and Task
private Employee employee;
private Task task;
//Constructor
public TaskLog(Employee employee, Task task, LocalDateTime from, LocalDateTime to) {
this.employee = employee;
this.task = task;
this.fromTime = from;
this.toTime = to;
}
//Method to calculate duration for the "Actual Time" spent on a TASK
public long getMinutesSpent() {
// Duration
return Duration.between(fromTime, toTime).toMinutes();
}
public LocalDateTime getFromTime() {
return fromTime;
}
public LocalDateTime getToTime() {
return toTime;
}
public Employee getEmployee() {
return employee;
}
public Task getTask() {
return task;
}
}