Ceiling Fan
public class CeilingFan {
public static final int OFF = 0;
public static final int LOW = 1;
public static final int MEDIUM = 2;
public static final int HIGH = 3;
private int speed;
public CeilingFan() {
speed = OFF;
}
public void high() {
speed = HIGH;
System.out.println("Fan set to HIGH");
}
public void medium() {
speed = MEDIUM;
System.out.println("Fan set to MEDIUM");
}
public void low() {
speed = LOW;
System.out.println("Fan set to LOW");
}
public void off() {
speed = OFF;
System.out.println("Fan is OFF");
}
public int getSpeed() {
return speed;
}
}