Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Gift smallGift = new Gift();

            Sweet sw1 = new BarSweet("Mars", 0.100, 0.050, 0.022, 0.020);
            Sweet sw2 = new BarSweet("Snickers", 0.150, 0.070, 0.033, 0.030);
            Sweet sw3 = new ChocolateSweet("Аленка", 0.200, 0.100, 0.001);
            Sweet sw4 = new ChocolateSweet("Milka", 0.100, 0.088, 0.045);

            smallGift.AddSweet(sw1);
            smallGift.AddSweet(sw2);
            smallGift.AddSweet(sw3);
            smallGift.AddSweet(sw4);

            Console.WriteLine("- - - Small gift - - -");
            smallGift.Consist();
            Console.WriteLine("- Small gift weigt: " + smallGift.Weight() + " kg. -");
            Console.WriteLine("- Small gift calorific: " + smallGift.Calorific() + " kcal. -");
            Console.WriteLine();

            Console.WriteLine("- - - Gift consist sorted by name - - -");
            smallGift.SortByName();
            smallGift.Consist();
            Console.WriteLine();

            Console.WriteLine("- - - Sweet in gift with Sugar in range 0.060-0.110 kg - - -");
            smallGift.FindSweetInRangeSugar(0.060, 0.110);
            Console.WriteLine();

            List<Sweet> initialListSweet = new List<Sweet> { sw1, sw1, sw3, sw3, sw2, sw4 };
            Gift bigGift = new Gift(initialListSweet);
            Console.WriteLine("- - - Big gift - - ");
            bigGift.Consist();
            Console.WriteLine("- Big gift weigt: " + bigGift.Weight() + " kg. -");
            Console.WriteLine("- Big gift calorific: " + bigGift.Calorific() + " kcal. -");
            Console.WriteLine();

            List<Sweet> middleListSweet = new List<Sweet> { sw1, sw2, sw3, sw4, sw4 };
            Gift middleGift = new Gift();
            middleGift.Make(middleListSweet);
            Console.WriteLine("- - - Midddle gift - - ");
            middleGift.Consist();
            Console.WriteLine();

            Console.WriteLine("press a key...");
            Console.ReadKey();
        }