public string AddFood(string type, string name, decimal price) { IFood food = null; switch (type) { case "Dessert": food = new Dessert(name, price); break; case "MainCourse": food = new MainCourse(name, price); break; case "Salad": food = new Salad(name, price); break; case "Soup": food = new Soup(name, price); break; default: break; } string result = string.Empty; if (food != null) { this.menu.Add(food); result = string.Format(OutputMessages.FoodMade, name, food.GetType().Name, food.Price); } return(result); }
public void GetMenu() { Console.WriteLine(soup.GetType().Name); Console.WriteLine(meal.GetType().Name); Console.WriteLine(dessert.GetType().Name); }