Beispiel #1
0
        public void Test()
        {
            double           allCubatureSum = 0;
            List <ICubature> cubatures      = new List <ICubature>();

            var cube1 = new Cube(10);
            var cube2 = new Cube(20);

            var sphere1 = new Sphere(10);
            var sphere2 = new Sphere(20);

            var cylinder1 = new Cylinder(10, 10);
            var cylinder2 = new Cylinder(20, 20);

            var cone1 = new Cone(10, 10);
            var cone2 = new Cone(20, 20);

            cubatures.Add(cube1);
            cubatures.Add(cube2);
            cubatures.Add(sphere1);
            cubatures.Add(sphere2);
            cubatures.Add(cylinder1);
            cubatures.Add(cylinder2);
            cubatures.Add(cone1);
            cubatures.Add(cone2);

            foreach (var item in cubatures)
            {
                var temp = item.CalculateCubature(); // [PIOTR] - ta linijka raczej niepotrzebna ;)
                allCubatureSum += item.CalculateCubature();
            }
        }
Beispiel #2
0
        public void Test()
        {
            var cone1     = new Cone(2, 8);
            var cone2     = new Cone(3, 10);
            var cube1     = new Cube(5);
            var cube2     = new Cube(10);
            var cylinder1 = new Cylinder(4, 10);
            var cylinder2 = new Cylinder(5, 12);
            var sphere1   = new Sphere(10);
            var sphere2   = new Sphere(20);

            var totalAreaList = new List <ITotalArea>
            {
                cone1,
                cone2,
                cube1,
                cube2,
                cylinder1,
                cylinder2,
                sphere1,
                sphere2,
            };

            var volumeList = new List <IVolume>
            {
                cone1,
                cone2,
                cube1,
                cube2,
                cylinder1,
                cylinder2,
                sphere1,
                sphere2,
            };

            var aggregateTotalArea = new double();
            var aggregateVolume    = new double();

            for (int i = 0; i < totalAreaList.Count; i++)
            {
                aggregateTotalArea += totalAreaList[i].TotalArea;
            }

            for (int i = 0; i < volumeList.Count; i++)
            {
                aggregateVolume += volumeList[i].Volume;
            }
            Console.ReadKey();
        }