50 lines
829 B
D
50 lines
829 B
D
module command.remoteundostatus.ceilingfan;
|
|
|
|
import std.stdio : writeln;
|
|
|
|
class CeilingFan
|
|
{
|
|
private string location;
|
|
private int speed;
|
|
|
|
static const int HIGH = 3;
|
|
static const int MEDIUM = 2;
|
|
static const int LOW = 1;
|
|
static const int OFF = 0;
|
|
|
|
this(string location)
|
|
{
|
|
this.location = location;
|
|
}
|
|
|
|
void high()
|
|
{
|
|
speed = HIGH;
|
|
writeln(location ~ " ceiling fan is on high");
|
|
|
|
}
|
|
|
|
void medium()
|
|
{
|
|
speed = MEDIUM;
|
|
writeln(location ~ " ceiling fan is on medium");
|
|
}
|
|
|
|
void low()
|
|
{
|
|
speed = LOW;
|
|
writeln(location ~ " ceiling fan is on low");
|
|
}
|
|
|
|
void off()
|
|
{
|
|
speed = OFF;
|
|
writeln(location ~ " ceiling fan is off");
|
|
}
|
|
|
|
int getSpeed()
|
|
{
|
|
return speed;
|
|
}
|
|
}
|