Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a Java question. For it, we will assume the following: Class TelevisionC

ID: 3738205 • 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 accessors 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 accessors for that class.

Explanation / Answer

TelevisionChannel.java

public class TelevisionChannel {

private String name;

private int number;

private boolean cable;

public TelevisionChannel() {

name = "";

number = 0;

cable = false;

}

public TelevisionChannel(String name, int number, boolean cable) {

this.name = name;

this.number = number;

this.cable = cable;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getNumber() {

return number;

}

public void setNumber(int number) {

this.number = number;

}

public boolean isCable() {

return cable;

}

public void setCable(boolean cable) {

this.cable = cable;

}

public int business() {

int count = 0;

while(number > 0) {

count++;

number/=10;

}

return count;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote