namespace ColourLamp;
public class Lamp
{
//Attributes
public bool IsOn;
public string Color;
//Initializing
public Lamp(string Color)
{
IsOn = false;
this.Color = Color;
}
//Methods
public string ShowCurrentColor()
{
for (int i = 0; i <= 10; i++)
{
for (int j = 1; j <= 2; j++)
{
if (SwitchArray[i][0])
return "Red";
if (SwitchArray[i][1])
return "Green";
if (SwitchArray[i][2])
return "Blue";
}
}
}
public bool IsLampOn()
{
return IsOn;
}
public void TurnOn()
{
if (! IsLampOn())
IsOn = true;
}
public void TurnOff()
{
if (IsLampOn())
IsOn = false;
}
}
namespace ColourLamp;
public class Lamp
{
//Attributes
public bool IsOn;
public string Color;
//Initializing
public Lamp(string Color)
{
IsOn = false;
this.Color = Color;
}
//Methods
public string ShowCurrentColor()
{
for (int i = 0; i <= 10; i++)
{
for (int j = 1; j <= 2; j++)
{
if (SwitchArray[i][0])
return "Red";
if (SwitchArray[i][1])
return "Green";
if (SwitchArray[i][2])
return "Blue";
}
}
}
public bool IsLampOn()
{
return IsOn;
}
public void TurnOn()
{
if (! IsLampOn())
IsOn = true;
}
public void TurnOff()
{
if (IsLampOn())
IsOn = false;
}
}