Exemplo n.º 1
0
 public Hamburger CreateBurger(string name)
 {
     if (name.Equals("VB"))
     {
         var a = new VeggHamburgerBuilder();
         a.BuildHamburger();
         return(a.GetHamburger());
     }
     if (name.Equals("VBL"))
     {
         var a = new VeggHambBuilderLettuce();
         a.BuildHamburger();
         return(a.GetHamburger());
     }
     if (name.Equals("CB"))
     {
         var a = new HamBurgerCheese();
         a.BuildHamburger();
         return(a.GetHamburger());
     }
     if (name.Equals("CBB"))
     {
         var a = new BaconHam();
         a.BuildHamburger();
         return(a.GetHamburger());
     }
     throw new ArgumentException($"cannot create burget {name} !");
 }
        public Hamburger CreateHamburger(string hamburgerName)
        {
            if (hamburgerName.Equals("VeggNormalHamburger"))
            {
                VeggHamburgerBuilder vhb = new VeggHamburgerBuilder();
                vhb.BuildHamburger();
                return(vhb.GetHamburger());
            }
            else if (hamburgerName.Equals("VeggHamburgerWithLettuce"))
            {
                VeggHambBuilderLettuce vhl = new VeggHambBuilderLettuce();
                vhl.BuildHamburger();
                return(vhl.GetHamburger());
            }
            else if (hamburgerName.Equals("CheeseNormalHamburger"))
            {
                CheeseHamburgerBuilder chb = new CheeseHamburgerBuilder();
                chb.BuildHamburger();
                return(chb.GetHamburger());
            }
            else if (hamburgerName.Equals("CheeseHamburgerWithOnion"))
            {
                CheeseHambBuilderOnion cho = new CheeseHambBuilderOnion();
                cho.BuildHamburger();
                return(cho.GetHamburger());
            }

            throw new ArgumentException($"cannot create hamburger from type {hamburgerName} !");
        }
Exemplo n.º 3
0
        public Hamburger getHamburger(string hamburgerName)
        {
            HamburgerBuilder builder = null;

            switch (hamburgerName)
            {
            case ("Crispy Chicken"):
            {
                builder = new CrispyChickenBuilder();
                break;
            }

            case ("Crispy Chicken With Tomato"):
            {
                builder = new CrispyChickenBuilderTomato();
                break;
            }

            case ("Veggy Burger"):
            {
                builder = new VeggHamburgerBuilder();
                break;
            }

            case ("Veggy Burger With Lettuce"):
            {
                builder = new VeggHambBuilderLettuce();
                break;
            }
            }

            return(builder.GetHamburger());
        }
Exemplo n.º 4
0
        public Hamburger GetVehicle(string hamburgerType)
        {
            if (hamburgerType == "Veggie")
            {
                HamburgerBuilder temp = new VeggHamburgerBuilder();
                temp.BuildHamburger();

                return temp.GetHamburger();
            }
            else if (hamburgerType == "VeggieLettuce")
            {
                HamburgerBuilder temp = new VeggHambBuilderLettuce();
                temp.BuildHamburger();

                return temp.GetHamburger();
            }
            else if (hamburgerType == "Meat")
            {
                HamburgerBuilder temp = new MeatHamburgerBuilder();
                temp.BuildHamburger();

                return temp.GetHamburger();
            }
            else if (hamburgerType == "MeatLettuce")
            {
                HamburgerBuilder temp = new MeatHamburgerLettuce();
                temp.BuildHamburger();

                return temp.GetHamburger();
            }

            throw (new Exception("Invalid hamburger type"));
        }
Exemplo n.º 5
0
        public Hamburger createHamburger(string newHamburger)
        {
            switch (newHamburger)
            {
            case ("veg"):
            {
                VeggHamburgerBuilder vegBurger = new VeggHamburgerBuilder();
                vegBurger.BuildHamburger();
                return(vegBurger.GetHamburger());
            }

            case ("meat"):
            {
                MeatburgerBuilder meatBurger = new MeatburgerBuilder();
                meatBurger.BuildHamburger();
                return(meatBurger.GetHamburger());
            }

            case ("Lettuce"):
            {
                VeggHambBuilderLettuce LettuceBurger = new VeggHambBuilderLettuce();
                LettuceBurger.BuildHamburger();
                return(LettuceBurger.GetHamburger());
            }

            default:
                throw new HamburgerNotReadyException("Hamburger doent exsit.");;
            }
        }
Exemplo n.º 6
0
 public Hamburger createBurger(string burgerType)
 {
     if (burgerType == "veggie light")
     {
         VeggHambBuilderLettuce vb = new VeggHambBuilderLettuce();
         vb.BuildHamburger();
         Console.WriteLine("Creating veggie light burger");
         return(vb.GetHamburger());
     }
     else if (burgerType == "veggie")
     {
         VeggHamburgerBuilder v = new VeggHamburgerBuilder();
         v.BuildHamburger();
         Console.WriteLine("Creating veggie burger");
         return(v.GetHamburger());
     }
     else if (burgerType == "susu")
     {
         SusuBuilder s = new SusuBuilder();
         s.BuildHamburger();
         Console.WriteLine("Creating susu burger");
         return(s.GetHamburger());
     }
     else if (burgerType == "susu lettuce")
     {
         SusuBuilderLettuce sl = new SusuBuilderLettuce();
         sl.BuildHamburger();
         Console.WriteLine("Creating susu lettuce burger");
         return(sl.GetHamburger());
     }
     else
     {
         return(null);
     }
 }
Exemplo n.º 7
0
        public Hamburger CreateBurger(string burgerType)
        {
            if (burgerType == "veggie")
            {
                Console.WriteLine("Creating veggie burger...");
                VeggHamburgerBuilder b = new VeggHamburgerBuilder();
                b.BuildHamburger();

                return(b.GetHamburger());
            }
            else if (burgerType == "veggie lettuce")
            {
                Console.WriteLine("Creating veggie lettuce burger...");
                VeggHambBuilderLettuce b = new VeggHambBuilderLettuce();
                b.BuildHamburger();

                return(b.GetHamburger());
            }
            else if (burgerType == "susu")
            {
                Console.WriteLine("Creating susu burger...");
                SusuBuilder b = new SusuBuilder();
                b.BuildHamburger();

                return(b.GetHamburger());
            }
            else if (burgerType == "susu lettuce")
            {
                Console.WriteLine("Creating susu lettuce burger...");
                SusuBuilderLettuce b = new SusuBuilderLettuce();
                b.BuildHamburger();

                return(b.GetHamburger());
            }

            throw new ArgumentException($"cannot create {burgerType} burger!");
        }