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); } }
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!"); }