internal Burger GetBurger(char key)
        {
            Burger burger = null;

            if (_burgers.ContainsKey(key))
            {
                burger = _burgers[key];
            }
            else
            {
                switch (key)
                {
                case 'B':
                {
                    burger = new BaconMaster("Bacon Master", "American", "lots of bacon", 2.39m);
                    break;
                }

                case 'Q':
                {
                    burger = new BbqKing("BBQ King", "American", "Onion rings, lettuce, and BBQ sauce", 2.49m);
                    break;
                }
                }
                _burgers.Add(key, burger);
            }

            return(burger);
        }
Exemplo n.º 2
0
        public Slider GetSlider(char key)
        {
            Slider slider = null;

            if (_sliders.ContainsKey(key)) //If we've already created an instance of the requested type of slider, just use that.
            {
                slider = _sliders[key];
            }
            else //Otherwise, create a brand new slider instance.
            {
                switch (key)
                {
                case 'B': slider = new BaconMaster(); break;

                case 'V': slider = new VeggieSlider(); break;

                case 'Q': slider = new BBQKing(); break;
                }
                _sliders.Add(key, slider);
            }
            return(slider);
        }