/// <summary> /// Constructor /// </summary> /// <param name="size">egg size</param> /// <param name="color">egg color</param> public Egg(int size, EggColor color) { amountLeft = size; this.color = color; }
/// <summary> /// Dyes the egg the given color. Only white eggs can be dyed, /// and eggs can only be dyed blue /// </summary> /// <param name="color">color to dye the egg</param> public void Dye(EggColor color) { if (this.color == EggColor.White) { if (color == EggColor.Blue) { this.color = EggColor.Blue; } } }
/// <summary> /// Dyes the egg the given color. Only white eggs can be dyed, /// and eggs can only be dyed blue /// </summary> /// <param name="color">color to dye the egg</param> public void Dye(EggColor color) { if (this.color == EggColor.White && color == EggColor.Blue) { this.color = color; // else // { // Console.WriteLine("Sorry egg can be dyed in only blue color"); // } } #endregion }