Java Reference
In-Depth Information
return power;
}
public int volumeUp(int increment) {
if(!power) // If the power is off
return 0; // Nothing works
// Set volume - must not be greater than the maximum
volume = volume+increment > MAX _ VOLUME ? MAX _ VOLUME : volume+increment;
System.out.println(make + " VCR volume level: "+ volume);
return volume;
}
public int volumeDown(int decrement) {
if(!power) // If the power is off
return 0; // Nothing works
// Set volume - must not be less than the minimum
volume = volume-decrement < MIN _ VOLUME ? MIN _ VOLUME : volume-decrement;
System.out.println(make + " VCR volume level: "+ volume);
return volume;
}
public void mute() {
if(!power) // If the power is off
return; // Nothing works
volume = MIN _ VOLUME;
System.out.println(make + " VCR volume level: "+ volume);
}
public int setChannel(int newChannel) {
if(!power) // If the power is off
return 0; // Nothing works
// Channel must be from MIN _ CHANNEL to MAX _ CHANNEL
if(newChannel>=MIN _ CHANNEL && newChannel<=MAX _ CHANNEL)
channel = newChannel;
System.out.println(make + " VCR tuned to channel: "+ channel);
return channel;
}
public int channelUp() {
if(!power) // If the power is off
return 0; // Nothing works
// Wrap channel up to MIN _ CHANNEL when MAX _ CHANNEL is reached
channel = channel<MAX _ CHANNEL ? ++channel : MIN _ CHANNEL;
System.out.println(make + " VCR tuned to channel: "+ channel);
return channel;
}
public int channelDown() {
Search WWH ::




Custom Search