Exemple #1
0
        static void Main(string[] args)
        {
            var phone = new SingleGift("Nokia 8", 550);

            phone.CalculateTotalPrice();

            Console.WriteLine();

            var rootBox = new CompositeGift("RootBox", 0);

            var truckToy = new SingleGift("Tonka", 420);
            var plainToy = new SingleGift("Plain", 587);

            rootBox.Add(truckToy);
            rootBox.Add(plainToy);

            var childBox   = new CompositeGift("ChildBox", 0);
            var soldierTOy = new SingleGift("Soldier", 200);

            childBox.Add(soldierTOy);

            rootBox.Add(childBox);

            Console.WriteLine($"Total price of this composite present is {rootBox.CalculateTotalPrice()}");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Gift phone = new SingleGift("Phone", 256);

            phone.CalculateTotalPrice();
            Console.WriteLine();

            //composite gift
            GiftBox rootBox = new GiftBox("RootBox", 0);

            Gift truckToy = new SingleGift("TruckToy", 289);
            Gift plainToy = new SingleGift("PlainToy", 587);

            rootBox.Add(truckToy);
            rootBox.Add(plainToy);

            GiftBox childBox = new GiftBox("ChildBox", 0);

            Gift soldierToy = new SingleGift("SoldierToy", 200);

            childBox.Add(soldierToy);

            rootBox.Add(childBox);

            GiftBox newToyBox = new GiftBox("New toy box", 0);

            Gift carToy = new SingleGift("CarToy", 300);

            newToyBox.Add(carToy);

            childBox.Add(newToyBox);

            Console.WriteLine("Total price of this composite present is: " + rootBox.CalculateTotalPrice());
        }
        public static void Main()
        {
            var eyeshadow = new SingleGift("Eyeshadow", 370);

            eyeshadow.CalculateTotalPrice();

            Console.WriteLine();

            var rootBox = new CompositeGift("RootBox", 0);

            var truckToy = new SingleGift("Trucky Toy", 289);
            var plainToy = new SingleGift("Plain Toy", 587);

            rootBox.Add(truckToy);
            rootBox.Add(plainToy);

            var childBox = new CompositeGift("ChildBox", 0);

            var soliderToy = new SingleGift("Solider Toy", 200);

            childBox.Add(soliderToy);

            rootBox.Add(childBox);

            Console.WriteLine($"Total price of this composite present is: {rootBox.CalculateTotalPrice()}");
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var box = new CompositeGift("Box", 0);

            var truckToy    = new SingleGift("Truck", 10);
            var carToy      = new SingleGift("Car", 5);
            var airplaneToy = new SingleGift("Airplane", 15);

            box.Add(truckToy);
            box.Add(carToy);
            box.Add(airplaneToy);

            Console.WriteLine(box.CalculateTotalPrice());
        }
Exemple #5
0
        public static void Main(string[] args)
        {
            var phone = new SingleGift("Samsung", 450.50m);

            phone.CalculateTotalPrice();
            Console.WriteLine("----------------------------------------------------");

            var rootBox    = new CompositeGift("RootBox", 0m);
            var truckToy   = new SingleGift("Truck Toy", 65.60m);
            var soldierToy = new SingleGift("Soldier Toy", 120m);

            rootBox.Add(truckToy);
            rootBox.Add(soldierToy);

            Console.WriteLine($"Total price of the compsoite present is: {rootBox.CalculateTotalPrice()}");
        }
Exemple #6
0
        public static void Main()
        {
            var phone = new SingleGift("IPhone X", 2000);

            phone.CalculateTotalPrice();

            Console.WriteLine();

            var root = new CompositeGift("RootBox", 0);

            root.Add(new SingleGift("Laptop", 3000));
            root.Add(new SingleGift("MousePad", 20));
            root.Add(new SingleGift("Something", 300));
            root.Add(new SingleGift("d", 5));

            Console.WriteLine("Total price: " + root.CalculateTotalPrice());
        }
Exemple #7
0
        static void Main(string[] args)
        {
            SingleGift phone = new SingleGift("Phone", 256);

            phone.CalculateTotalPrice();
            Console.WriteLine();

            CompositeGfit rootBox  = new CompositeGfit("RootBox", 0);
            SingleGift    truckToy = new SingleGift("TryckToy", 289);
            SingleGift    plainToy = new SingleGift("PlainToy", 567);

            rootBox.Add(truckToy);
            rootBox.Add(plainToy);
            CompositeGfit childBox   = new CompositeGfit("ChildBox", 0);
            SingleGift    soldierToy = new SingleGift("SoldierToy", 200);

            childBox.Add(soldierToy);
            rootBox.Add(childBox);

            Console.WriteLine($"Total price of this composite present is: {rootBox.CalculateTotalPrice()}");
        }
Exemple #8
0
        public static void Main()
        {
            var phone = new SingleGift("Phone", 256);

            phone.CalculateTotalPrice();
            Console.WriteLine();

            var rootBox  = new CompositeGift("RootBox", 0);
            var truckToy = new SingleGift("TruckToy", 289);
            var plaiToy  = new SingleGift("PlainToy", 587);

            rootBox.Add(truckToy);
            rootBox.Add(plaiToy);
            var childBox   = new CompositeGift("ChildBox", 0);
            var soldierToy = new SingleGift("SoldierToy", 200);

            childBox.Add(soldierToy);
            rootBox.Add(childBox);

            Console.WriteLine($"Total price of this composite present is:{rootBox.CalculateTotalPrice()}");
        }
Exemple #9
0
        static void Main(string[] args)
        {
            var phone = new SingleGift("motorola", 250);

            phone.CalculateTotalPrice();
            Console.WriteLine("---------------------------------");

            var box   = new CompositeGift("BOX", 0);
            var watch = new SingleGift("Rolex", 320);
            var ring  = new SingleGift("GoldRing", 500);

            box.Add(watch);
            box.Add(ring);

            var smallBox   = new CompositeGift("SmallBox", 0);
            var neshoMalko = new SingleGift("minion", 110);

            smallBox.Add(neshoMalko);
            box.Add(smallBox);
            Console.WriteLine($"Total gift Price is {box.CalculateTotalPrice()}");
        }
Exemple #10
0
        public static void Main(string[] args)
        {
            var phone = new SingleGift("Phone", 500);

            phone.CalculateTotalPrice();
            Console.WriteLine();

            var rootBox  = new CompositeGift("RootBox", 0);
            var truckToy = new SingleGift("Truck toy", 200);
            var plainToy = new SingleGift("Plain toy", 300);

            rootBox.Add(truckToy);
            rootBox.Add(plainToy);

            var childBox   = new CompositeGift("Child Box", 0);
            var soldierToy = new SingleGift("Soldier toy", 400);

            childBox.Add(soldierToy);
            rootBox.Add(childBox);

            Console.WriteLine($"Total price from Composite present is: {rootBox.CalculateTotalPrice()}");
        }