Example #1
0
        public static void sMain(string[] args)
        {
            ShapeFactory    factory = new ShapeFactory();
            CircleWorker    cworker = new CircleWorker();
            RectangleWorker rworker = new RectangleWorker();
            Surface         surface = new Surface(factory);

            factory.AddWorker(cworker);
            factory.AddWorker(rworker);

            for (int i = 0; i < 6; i++)
            {
                surface.AddNewShape();
            }

            foreach (Shape shape in surface.Shapes)
            {
                shape.PrintInfo();
            }

            Console.WriteLine("");
            Console.WriteLine("Sumaryczne pole figur na płaszczyźnie to {0}", surface.ComputeTotalArea());
            Console.WriteLine("Sumaryczny obwód figur na płaszczyźnie to {0}", surface.ComputeTotalPerimeter());
        }
Example #2
0
 public Surface(ShapeFactory factory)
 {
     shapes       = new List <Shape>();
     this.factory = factory;
 }