001package headfirst.command.party;
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        }
014
015        public void high() {
016                // turns the ceiling fan on to high
017                speed = HIGH;
018                System.out.println(location + " ceiling fan is on high");
019        }
020
021        public void medium() {
022                // turns the ceiling fan on to medium
023                speed = 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                speed = LOW;
030                System.out.println(location + " ceiling fan is on low");
031        }
032
033        public void off() {
034                // turns the ceiling fan off
035                speed = OFF;
036                System.out.println(location + " ceiling fan is off");
037        }
038
039        public int getSpeed() {
040                return speed;
041        }
042}