/// <summary> /// Constructor to initialize a rectangle through two or four sides and other skin figure. /// </summary> /// <param name="sidesCollection">Two or four sides</param> /// <param name="figure">Other skin figure</param> public SkinRectangle(IEnumerable <double> sidesCollection, ISkinFigure figure) : base(sidesCollection) { double area = Sides[0] * Sides[1]; if (area > figure.GetArea()) { throw new ArgumentException("You cannot create a shape because the original shape is smaller."); } }
/// <summary> /// Constructor to initialize a circle through a radius and a other skin figure. /// </summary> /// <param name="radius">Cicle radius</param> /// /// <param name="figure">Other skin figure</param> public SkinCircle(double radius, ISkinFigure figure) : base(radius) { double area = Math.PI * Math.Pow(Radius, 2); if (area > figure.GetArea()) { throw new ArgumentException("You cannot create a shape because the original shape is smaller."); } }
/// <summary> /// Constructor to initialize a square through one or three sides and other skin figure. /// </summary> /// <param name="sidesCollection">Three sides</param> /// <param name="figure">Other skin figure</param> public SkinTriangle(IEnumerable <double> sidesCollection, ISkinFigure figure) : base(sidesCollection) { double halfPerimetr = Sides.Sum() / 2; double area = Math.Sqrt(halfPerimetr * (halfPerimetr - Sides[0]) * (halfPerimetr - Sides[1]) * (halfPerimetr - Sides[2])); if (area > figure.GetArea()) { throw new ArgumentException("You cannot create a shape because the original shape is smaller."); } }