/
CeilingFan.cs
48 lines (46 loc) · 1.08 KB
/
CeilingFan.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CommandPattern
{
class CeilingFan
{
public const int HIGH = 3;
public const int MEDIUM = 2;
public const int LOW = 1;
public const int OFF = 0;
string location;
int speed;
public CeilingFan(string location)
{
this.location = location;
speed= OFF;
}
public void high()
{
speed = HIGH;
Console.WriteLine("High wind in " + location);
}
public void medium()
{
speed = MEDIUM;
Console.WriteLine("medium wind in " + location);
}
public void low()
{
speed = LOW;
Console.WriteLine("lage wind in " + location);
}
public void off()
{
speed = OFF;
Console.WriteLine("geen wind in " + location);
}
public int getSpeed()
{
return speed;
}
}
}