-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhouse.java
More file actions
65 lines (50 loc) · 1.06 KB
/
Copy pathhouse.java
File metadata and controls
65 lines (50 loc) · 1.06 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
54
55
56
57
58
59
60
61
62
63
64
65
abstract class Device
{
String brand;
abstract void turnOn();
Device(String b)
{
brand = b;
}
}
interface RemoteControllable
{
void connectToWifi(String wifi);
}
interface PowerSaving
{
void getEnergyRating();
}
class SmartTV extends Device implements RemoteControllable, PowerSaving
{
SmartTV(String b)
{
super(b);
}
public void connectToWifi(String wifi)
{
System.out.println("Connecting to: " + wifi + "...");
}
public void turnOn()
{
System.out.println("Turning on " + brand + " TV...");
}
public void getEnergyRating()
{
System.out.println("Switching to Power Saving mode...");
}
}
public class house
{
public static void main(String[] args)
{
//1
Device d = new SmartTV("Sony");
d.turnOn();
//2
RemoteControllable r = new SmartTV("LG");
r.connectToWifi("HomeWifi");
//3
//r.turnOn();
}
}