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