Question: Hey guys! I'm having trouble with my code, I already filled in all of the TODO's, but i'm still getting an error. If anyone can

Hey guys! I'm having trouble with my code, I already filled in all of the TODO's, but i'm still getting an error. If anyone can check it out, that would be great,

Any help is appreciated, thank you guys!

CODE:

public class CTV { // TODO Declare a private int member variable, named channel private int channel; // TODO Declare a private int member variable, named volumeLevel private int volumeLevel; // TODO Declare a private boolean member variable, named isOn private boolean isOn; // TODO Declare and implement the getter method, named getChannel // with no input and returning an integer value as the current // channel public void getChannel(){ } // TODO Declare and implement the setter method, named setChannel // with an integer parameter named newChannel as input // The method changes the current channel and gives no return. public void setChannel(int newChannel){ } // TODO Declare and implement the getter method, named getVolumeLevel // with no input and returning an integer value as the current // volumeLevel. The methods changes the current volume level public void getVolumeLevel(){ } // TODO Declare and implement the setter method, named setVolumeLevel // with an integer parameter named newVolumeLevel as input // The method gives no return. public void setVolumeLevel(int newVolumeLevel){ } // TODO Declare and implement the setter method, named turnOn // with no input and no return // The method turn the power on public void setturnOn(){ } // TODO Declare and implement the setter method, named turnOff // with no input and no return // The method turn the power off public void setturnOff(){ } // TODO Declare and implement the getter method, named isOn // with no input and returning the power status // (true represents the power-on and false the power-off) public void getisOn(){ } public String toString(){ return "Settings: " + " Channel = " + this.getChannel() + " VolumeLevel = " + this.getVolumeLevel() + " Status = " + (this.isOn()? "on" : "off"); } public static void main(String[] args) { // TODO declare a CTV instance, named myTV CTV myTV=new CTV(); myTV.setChannel(7); myTV.setVolumeLevel(17); myTV.turnOn(); System.out.println(myTV.toString()); // TODO declare a CTV instance, named yourTV CTV yourTV=new CTV(); yourTV.setChannel(5); yourTV.setVolumeLevel(25); yourTV.turnOff(); System.out.println(yourTV.toString()); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!