-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAirConditioner.java
More file actions
76 lines (40 loc) · 1023 Bytes
/
Copy pathAirConditioner.java
File metadata and controls
76 lines (40 loc) · 1023 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
public class AirConditioner{
boolean isOn;
boolean ACStatus = false;
int temperature = 16;
public void turnOff(){
ACStatus = false;
temperature = 0;
}
public boolean turnOn(){
isOn = true;
return true;
}
public int increaseInTemperature(){
if(isOn == true && temperature < 30){
temperature = temperature + 1;
}
return temperature;
}
public int decreaseInTemperature(){
if(isOn == true && temperature > 16){
temperature = temperature - 1;
}
return temperature;
}
public int fixedIncreaseInTemperature(){
if (temperature > 30){
temperature = 30;
}
return temperature;
}
public int fixedDecreaseInTemperature(){
if (temperature < 16){
temperature = 16;
}
return temperature;
}
// public int getTemperatureValue(){
// if()}
//...
}