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