001package headfirst.command.undo;
002
003public class CeilingFan {
004        public static final int HIGH = 3;
005        public static final int MEDIUM = 2;
006        public static final int LOW = 1;
007        public static final int OFF = 0;
008        String location;
009        int speed;
010
011        public CeilingFan(String location) {
012                this.location = location;
013                speed = OFF;
014        }
015
016        public void high() {
017                speed = HIGH;
018                System.out.println(location + " ceiling fan is on high");
019        }
020
021        public void medium() {
022                speed = MEDIUM;
023                System.out.println(location + " ceiling fan is on medium");
024        }
025
026        public void low() {
027                speed = LOW;
028                System.out.println(location + " ceiling fan is on low");
029        }
030
031        public void off() {
032                speed = OFF;
033                System.out.println(location + " ceiling fan is off");
034        }
035
036        public int getSpeed() {
037                return speed;
038        }
039}