-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTime.java
42 lines (37 loc) · 790 Bytes
/
Time.java
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
/**
* A simple class that implements time to the simulation.
*
* @author Aymen Berbache and Aleks
* @version 2022.02
*/
public class Time {
// A boolean that holds the current state of time.
private static boolean isDay = false;
public Time()
{
}
/**
* Change the current time by switching the state of the boolean.
*/
public void switchTime(){
isDay = !isDay;
}
/**
* @return The current state of time.
*/
public boolean isDay(){
return isDay;
}
/**
* @return A string containing the current state of time.
*/
public String getIsDay(){
String s = "";
if(isDay()){
s += "Day";
}else{
s+= "Night";
}
return s;
}
}