class TV{
private boolean power;
private int channel;
private int volume;
TV() {
this.power=false;
this.channel=2;
this.volume=0;
}
boolean getPower() {
return this.power;
}
int getChannel() {
return this.channel;
}
int getVolume() {
return this.volume;
}
void getDisplay() {
System.out.println("The power is "+this.power+"."
System.out.println("The channel is "+this.channel+"."
System.out.println("The volume is "+this.volume+"."
}
if (this.power=1){
this.power=true;
else
this.power= false;
System.out.println("Please enter 1 to turn on TV or 0 to turn off TV."
}
if (this.channel >= 2){
this.channel++;
else if (this.channel > 13)
this.channel=2;
else
System.out.println("Re-enter again!!!"
}
if ((this.volume >= 0)&&(this.volume<10)){
this.volume++;
else
System.out.println("Re-enter again!!!"
}
}
private boolean power;
private int channel;
private int volume;
TV() {
this.power=false;
this.channel=2;
this.volume=0;
}
boolean getPower() {
return this.power;
}
int getChannel() {
return this.channel;
}
int getVolume() {
return this.volume;
}
void getDisplay() {
System.out.println("The power is "+this.power+"."
System.out.println("The channel is "+this.channel+"."
System.out.println("The volume is "+this.volume+"."
}
if (this.power=1){
this.power=true;
else
this.power= false;
System.out.println("Please enter 1 to turn on TV or 0 to turn off TV."
}
if (this.channel >= 2){
this.channel++;
else if (this.channel > 13)
this.channel=2;
else
System.out.println("Re-enter again!!!"
}
if ((this.volume >= 0)&&(this.volume<10)){
this.volume++;
else
System.out.println("Re-enter again!!!"
}
}