Java编程谢谢大家,急用!!!!!!!!!

javastringboolean
模拟实现电风扇,可以调 3 档速度(慢速、中速、快速);开关按钮;定时吹风;描述
风扇的扇叶大小、颜色等。
设计Fan 类,属性包括:3 个常量 SLOW (1)、MEDIUM(2)、FA ST(3)代表风扇的
速度;1 个int 属性speed 指定速度,默认值为 SLOW ;1 个boolean属性 on 指定开关机,默
认值false ;1 个double 属性 radius 指定风扇扇叶大小;1 个String 属性 color指定扇叶颜色,
默认值为 blue 。方法包括这些属性的访问器、构造函数、重写 Object 类的 toString() 和equals()

 public class Fan {

    public Fan() {}

    public static final int SLOW = 1;

    public static final int MEDIUM = 2;

    public static final int FA = 3;

    public int speed = SLOW;

    public boolean on = false;

    public double radius = 0.0d;

    public String color = "blue";

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public boolean isOn() {
        return on;
    }

    public void setOn(boolean on) {
        this.on = on;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((color == null) ? 0 : color.hashCode());
        result = prime * result + (on ? 1231 : 1237);
        long temp;
        temp = Double.doubleToLongBits(radius);
        result = prime * result + (int) (temp ^ (temp >>> 32));
        result = prime * result + speed;
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Fan other = (Fan) obj;
        if (color == null) {
            if (other.color != null)
                return false;
        } else if (!color.equals(other.color))
            return false;
        if (on != other.on)
            return false;
        if (Double.doubleToLongBits(radius) != Double
                .doubleToLongBits(other.radius))
            return false;
        if (speed != other.speed)
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "Fan [speed=" + speed + ", on=" + on + ", radius=" + radius
                + ", color=" + color + "]";
    }
}