-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoom.java
More file actions
53 lines (50 loc) · 1.43 KB
/
Room.java
File metadata and controls
53 lines (50 loc) · 1.43 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
50
51
52
53
import java.util.Scanner;
public class Room {
boolean AC_ON;
boolean HOME_THEATRE_ON;
boolean FAN_ON;
boolean LIGHT_ON;
int power=0;
Room(boolean ac, boolean theatre, boolean fan, boolean light){
AC_ON = ac;
HOME_THEATRE_ON =theatre;
FAN_ON = fan;
LIGHT_ON = light;
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
Room obj = new Room(s.nextBoolean(),s.nextBoolean(),s.nextBoolean(),s.nextBoolean());
int power = obj.power;
if(obj.AC_ON == true){
power = power + 1200;
System.out.println("AC is ON");
}
else{
System.out.println("AC is OFF");
}
if(obj.HOME_THEATRE_ON == true){
power = power + 600;
System.out.println("Theatre is ON");
}
else{
System.out.println("Theatre is OFF");
}
if(obj.FAN_ON == true){
power = power + 400;
System.out.println("FAN is ON");
}
else{
System.out.println("FAN is OFF");
}
if(obj.LIGHT_ON == true){
power = power + 100;
System.out.println("Light is ON");
}
else{
System.out.println("Light is OFF");
}
if(power>2000){
System.out.println("Overload");
}
}
}