This is a Java question. For it, we will assume the following: Class TelevisionC
ID: 3738206 • Letter: T
Question
This is a Java question. For it, we will assume the following: Class TelevisionChannel has three fields: name, a String; number, an integer; and Boolean, which represents whether the channel is a cable channel. Code the three mutators for that class. This is a Java question. For it, we will assume the following: Class TelevisionChannel has three fields: name, a String; number, an integer; and Boolean, which represents whether the channel is a cable channel. Code the three mutators for that class.Explanation / Answer
// TelevisionChannel.java
public class TelevisionChannel
{
// variables
private String number;
private int channel;
private boolean hasCable;
// mutators methods
//setters
public void setNumber(String num)
{
number = num;
}
public void setChannel(int ch)
{
channel = ch;
}
public void sethasCable(boolean hasC)
{
hasCable = hasC;
}
//getters
public String setNumber()
{
return number;
}
public int setChannel()
{
return channel;
}
public boolean sethasCable()
{
return hasCable;
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.