State Pattern - Demo - TV Remote
package StatePatternDemoOne;
public interface State {
public void doAction();
}
package StatePatternDemoOne;
public class TVStartState implements State {
@Override
public void doAction() {
System.out.println("TV is turned ON");
}
}
package StatePatternDemoOne;
public class TVStopState implements State {
@Override
public void doAction() {
System.out.println("TV is turned OFF");
}
}
Driver - TVRemote:
COSC-1437 / ITSE-2457 Computer Science Dept. - Author: Dr. Kevin Roark