forked from Denisolt/CSCI-160
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTelevision.java
More file actions
83 lines (73 loc) · 1.98 KB
/
Television.java
File metadata and controls
83 lines (73 loc) · 1.98 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// The purpose of this class is to model a television
//Denisolt Shakhbulatov 10.22.2015
/* ____________________________________________
+ Television +
+_____________________________________________+
+ -MANUFACTURER: String +
+ -SCREEN_SIZE: int +
+ -powerOn: boolean +
+ -channel: int +
+ -volume: int +
+_____________________________________________+
+ +Television(brand: String, size: int): +
+ +setChannel (station: int): void +
+ +power( ): void +
+ +increaseVolume( ): void +
+ +decreaseVolume( ): void +
+ +getChannel( ): int +
+ +getVolume( ): int +
+ +getManufacturer( ): String +
+ +getScreenSize( ): int +
_______________________________________________
*/
public class Television
{
private String manufacturer;
private int screen_size;
private boolean powerOn;
private int channel;
private int volume;
public Television( String brand, int size)
{
manufacturer = brand;
screen_size = size;
powerOn = false;
volume = 20;
channel = 2;
}
public void setChannel(int station)
{
channel = station;
}
public void power()
{
if (powerOn==true)
powerOn=false;
else
powerOn=true;
}
public void increaseVolume()
{
volume = volume + 1;
}
public void decreaseVolume()
{
volume = volume - 1;
}
public int getChannel()
{
return channel;
}
public int getVolume()
{
return volume;
}
public String getManufacturer()
{
return manufacturer;
}
public int getScreenSize()
{
return screen_size;
}
}