-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTelevision.java
94 lines (57 loc) · 1.53 KB
/
Television.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//Captain-Price-TF-141
public class Television
{
private String manufacturer;
private boolean powerOn;
private int screenSize, channel, volume;
//The Television constructor accepts parameters for screenSize and manufacturer.
//The default powerOn value is false, the default volume is 20, and the default channel is 2.
Television(String manufacturer, int screenSize)
{
this.manufacturer = manufacturer;
this.screenSize = screenSize;
powerOn = false;
volume = 20;
channel = 2;
}
//The setChannel method accepts an int newChannel and sets the current channel to newChannel's value.
public void setChannel(int newChannel)
{
channel = newChannel;
}
//The power method will turn off the Television if it is on and vise versa.
public void power()
{
powerOn = !powerOn;
}
//The increaseVolume method will increase the volume by 1.
public void increaseVolume()
{
volume += 1;
}
//The decreaseVolume method will decrease the volume by 1.
public void decreaseVolume()
{
volume -= 1;
}
//The getChannel method will return the current value in cahnnel.
public int getChannel()
{
return channel;
}
//The getVolume method will return the current value in volume.
public int getVolume()
{
return volume;
}
//The getManufacturer mehtod will return the current String in manufacturer.
public String getManufacturer()
{
return manufacturer;
}
//The getScreenSize method will return the current value in screenSize.
public int getScreenSize()
{
return screenSize;
}
}