0
/ 1.0
For this question you will be working with the following two classes:
public class Television { private int currentChannelNumber; public...
For this question you will be working with the following two classes:
public class Television
{
private int currentChannelNumber;
public Television()
{
currentChannelNumber = 1;
}
public int getCurrentChannelNumber()
{
return this.currentChannelNumber;
}
public void setChannel(int channelNumber)
{
this.currentChannelNumber = channelNumber;
}
}
public class Remote
{
private Television tv;
public Remote()
{
tv = new Television();
}
}
For this question you will be working within the Remote
class.
Implement the keyInChannel()
method, which takes in a channel
number, so it sets the TV to that channel number. However, this TV
only has 10 available channels (channels 1 - 10). This method
should only change the channel on the TV if the parameter passed
is between 1 and 10 (inclusive).
Your feedback will appear here when you check your answer.