-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTime.java
More file actions
40 lines (31 loc) · 789 Bytes
/
Time.java
File metadata and controls
40 lines (31 loc) · 789 Bytes
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
package garageSystem;
import java.time.*;
import java.time.temporal.*;
public class Time {
private LocalTime startTime;
private LocalTime endTime;
Time (){
}
Time(LocalTime start, LocalTime end)
{
startTime = start;
endTime = end;
}
public void setEndTime (Vehicle vehicle){
vehicle.setEndTime(LocalTime.now());
}
public void setStartTime(Vehicle vehicle){
vehicle.setStartTime(LocalTime.now());
}
public LocalTime getStartTime()
{return startTime;}
public LocalTime getEndTime()
{return endTime;}
public int parkingTime(Vehicle vehicle){
int start = vehicle.getStartTime().getHour();
int end = vehicle.getEndTime().getHour();
if (start-end==0)
return 1;
return (start-end);
}
}