public override string ToString() { var sb = new StringBuilder(); sb.AppendLine($"---- {Name} ----"); if (Dough != null) { sb.AppendLine(Dough.ToString()); } if (Sauce != null) { sb.AppendLine(Sauce.ToString()); } if (Cheese != null) { sb.AppendLine(Cheese.ToString()); } if (Veggies != null) { sb.AppendLine(string.Join(",", Veggies)); } if (Clam != null) { sb.AppendLine(Clam.ToString()); } if (Pepperoni != null) { sb.AppendLine(Pepperoni.ToString()); } return(sb.ToString()); }
public void Display() { Console.WriteLine("SANDWICH"); Console.WriteLine($"\tCBread: {Bread.ToString()}"); Console.WriteLine($"\tCheese: {Cheese.ToString()}"); Console.WriteLine($"\tMeat: {Meat.ToString()}"); Console.WriteLine($"\tVegetables: {string.Join(',', Vegetables)}"); }
public void Debug() { Console.WriteLine("--------------"); Console.WriteLine(name); Console.WriteLine("Cheese is " + (cheese != null ? cheese.ToString() : "Null")); Console.WriteLine("Sauce is " + (sauce != null ? sauce.ToString() : "Null")); Console.WriteLine("Onion is " + (onion != null ? onion.ToString() : "Null")); Console.WriteLine("--------------"); }
public override void Prepare() { Console.WriteLine("Preparing {0}", Name); Dough = pizzaIngredientFactory.CreateDough(); Sauce = pizzaIngredientFactory.CreateSauce(); Cheese = pizzaIngredientFactory.CreateCheese(); Veggies = pizzaIngredientFactory.CreateVeggies(); Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2}", Dough.ToString(), Sauce.ToString(), Cheese.ToString()); Console.Write("Additional Vegtables: "); foreach (Veggies vegtable in Veggies) { Console.Write(vegtable.ToString() + ", "); } Console.Write("\n"); }
public override string ToString() { var result = new StringBuilder(); result.AppendLine("---- " + Name + " ----"); if (Dough != null) { result.AppendLine(Dough.ToString()); } if (Sauce != null) { result.AppendLine(Sauce.ToString()); } if (Cheese != null) { result.AppendLine(Cheese.ToString()); } if (Veggies != null) { bool isFirst = true; foreach (var veggy in Veggies) { if (isFirst) { result.Append(veggy.ToString()); isFirst = false; } else { result.Append(", "); result.Append(veggy.ToString()); } } result.AppendLine(); } if (Pepperoni != null) { result.AppendLine(Pepperoni.ToString()); } if (Clams != null) { result.AppendLine(Clams.ToString()); } return(result.ToString()); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append($"{Crust} pizza {(HasSauce ? "with" : "without")} sauce with "); sb.AppendLine($"{Cheese?.ToString().ToLower() ?? "no"} cheese. Toppings: "); foreach (ToppingKind topping in Toppings) { sb.AppendLine($"\t{topping}"); } if (Oregano) { sb.AppendLine("with oregano on top"); } return(sb.ToString()); }
public override string ToString() { var result = new StringBuilder(); result.AppendLine("---- " + Name + " ----"); if (Dough != null) { result.AppendLine(Dough.ToString()); } if (Sauce != null) { result.AppendLine(Sauce.ToString()); } if (Cheese != null) { result.AppendLine(Cheese.ToString()); } if (Veggies != null) { for (int i = 0; i < Veggies.Length; i++) { result.Append(Veggies[i].ToString()); if (i < Veggies.Length - 1) { result.Append(", "); } } result.Append("\n"); } if (Clam != null) { result.AppendLine(Clam.ToString()); } if (Pepperoni != null) { result.AppendLine(Pepperoni.ToString()); } return(result.ToString()); }
public override void Prepare() { Console.WriteLine("Preparing {0}", Name); Dough = pizzaIngredientFactory.CreateDough(); Sauce = pizzaIngredientFactory.CreateSauce(); Cheese = pizzaIngredientFactory.CreateCheese(); Pepperoni = pizzaIngredientFactory.CreatePepperoni(); Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2} - Pepperoni: {3}", Dough.ToString(), Sauce.ToString(), Cheese.ToString(), Pepperoni.ToString()); }
public override void Prepare() { Console.WriteLine("Preparing {0}", Name); Dough = pizzaIngredientFactory.CreateDough(); Sauce = pizzaIngredientFactory.CreateSauce(); Cheese = pizzaIngredientFactory.CreateCheese(); Veggies = pizzaIngredientFactory.CreateVeggies(); Clam = pizzaIngredientFactory.CreateClam(); Console.WriteLine("Ingredients: Dough: {0} - Sauce: {1} - Cheese: {2} - Clam: {3}", Dough.ToString(), Sauce.ToString(), Cheese.ToString(), Clam.ToString()); }