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: 3738204 • 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 a constructor for that class that takes three parameters. 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 a constructor for that class that takes three parameters.

Explanation / Answer

public class TelevisionChannel

{

    String name;

    int number;

    boolean cable;

   

    // constructor

    TelevisionChannel()

    {

        this.name = "";

        this.number = 0;

        this.cable = true;

    }

   

    // constructor

    TelevisionChannel(String name, int number, boolean cable)

    {

        this.name = name;

        this.number = number;

        this.cable = cable;

    }

   

    // getter methods

    public String getName()

    {

        return this.name;

    }

   

    public int getNumber()

    {

        return this.number;

    }

   

    public boolean isCable()

    {

        return this.cable;

    }

   

    // setter methods

    public void setName(String name)

    {

        this.name = name;

    }

   

    public void setNumber(int number)

    {

        this.number = number;

    }

   

    public void setCable(boolean cable)

    {

        this.cable = cable;

    }

   

}

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