Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IToy doll       = new Doll();
            IToy warrior    = new Warrior();
            IToy raceDriver = new RaceDriver();

            // Everythong works properly, jsut main should look better but I was out of time
            IToy minotaur = new Centaur("John", 9, true);

            AddSword   sword = new AddSword(minotaur);
            AddJumping dress = new AddJumping(sword);

            Console.WriteLine(dress.Cost());
            Console.WriteLine(dress.Summary());
            Console.WriteLine(dress.Height());

            Console.WriteLine(dress.Summary());
            Console.WriteLine(dress.Summary());
            Console.WriteLine(dress.Summary());
            Console.WriteLine(dress.Summary());
            Console.WriteLine(dress.Summary());

            AddDancing dancingToy = new AddDancing(dress, "gangnam style");

            Console.WriteLine(dancingToy.Summary());
            AddDancing dancing2Toy = new AddDancing(dancingToy, "solo capoeira");

            Console.WriteLine(dancing2Toy.Summary());

            AddStory storyToy = new AddStory(dancing2Toy, "jokes");

            Console.WriteLine(storyToy.Summary());
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            IToy doll       = new Doll();
            IToy warrior    = new Warrior();
            IToy raceDriver = new RaceDriver();

            // Please make sure to put here the code which shows what you've implemented
            doll = new SwordDecorator(doll);
            Console.WriteLine(doll.Cost());
            Console.WriteLine(doll.Summary());
            doll = new HelmetDecorator(doll);
            Console.WriteLine(doll.Cost());
            Console.WriteLine(doll.Summary());
            raceDriver = new DressDecorator(raceDriver, true);
            Console.WriteLine(raceDriver.Cost());
            Console.WriteLine(raceDriver.Summary());
            doll = new JumpDecorator(doll);
            Console.WriteLine(doll.Cost());
            Console.WriteLine(doll.Summary());
            Console.WriteLine(doll.Summary());
            Console.WriteLine(doll.Summary());
            Console.WriteLine(doll.Summary());
            Console.WriteLine(doll.Summary());
            Console.WriteLine(doll.Summary());
            warrior = new DanceDecorator(warrior, "breakdance");
            warrior = new DanceDecorator(warrior, "solo capoeira");
            Console.WriteLine(warrior.Cost());
            Console.WriteLine(warrior.Summary());

            IToy minotaur = new Minotaur("Bob", 32, 86);

            Console.WriteLine(minotaur.Cost());
            Console.WriteLine(minotaur.Summary());
            IToy centaur = new Centaur("Jeff", 42, true);

            Console.WriteLine(centaur.Cost());
            Console.WriteLine(centaur.Summary());
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            IToy doll       = new Doll();
            IToy warrior    = new Warrior();
            IToy raceDriver = new RaceDriver();

            // Please make sure to put here the code which shows what you've implemented
            warrior = new SwordDecorator(warrior);
            warrior = new HelmetDecorator(warrior);
            warrior = new JumpDecorator(warrior);
            //Console.WriteLine(warrior.Cost());
            //Console.WriteLine(warrior.Summary());
            //Console.WriteLine(warrior.Summary());
            //Console.WriteLine(warrior.Summary());
            //Console.WriteLine(warrior.Summary());
            //Console.WriteLine(warrior.Summary());
            //Console.WriteLine(warrior.Summary());
            //Console.WriteLine(warrior.Summary());
            doll = new DanceDecorator(doll, "gangnam style");
            doll = new DanceDecorator(doll, "breakdance");
            doll = new DressDecorator(doll, true);
            //Console.WriteLine(doll.Cost());
            //Console.WriteLine(doll.Summary());
            raceDriver = new StoryDecorator(raceDriver, true);
            //Console.WriteLine(raceDriver.Cost());
            //Console.WriteLine(raceDriver.Summary());
            IToy minotaur = new Minotaur("Adam", 23, 1000);
            //Console.WriteLine(minotaur.Cost());
            //Console.WriteLine(minotaur.Summary());
            IToy centaur = new Centaur("Adam", 23, true);

            centaur = new SwordDecorator(centaur);
            centaur = new HelmetDecorator(centaur);
            Console.WriteLine(centaur.Cost());
            Console.WriteLine(centaur.Summary());
        }