static void Main(string[] args) { MenuRepository Repository = new MenuRepository(); while (true) { Console.Clear(); Console.WriteLine("Commands:\nAdd: 'add'\nList: 'list'\nDelete: 'delete'"); string Command = Console.ReadLine().ToLower(); if (Command == "add") { MenuItem newItem = NewMenuItem(); Repository.AddItem(newItem); } else if (Command == "list") { Console.Clear(); foreach (MenuItem Item in Repository.GetMenuItems()) { Console.WriteLine($"[{Item.OrderNumber}]: {Item.OrderName}, \n {Item.Description}, \n {Item.Ingredients}, \n ${Item.Price}"); } Console.WriteLine("Press Enter to continue."); Console.Read(); } else if (Command == "delete") { Console.Clear(); Console.WriteLine("What Order Number would you like to remove?"); int OrderNumber = Int32.Parse(Console.ReadLine()); Repository.RemoveItem(OrderNumber); Console.WriteLine("Item Removed. Press Enter to continue."); Console.Read(); } } }
public static void ViewOptionSimple() { Console.WriteLine(divider); Console.WriteLine("Komodo Cafe Menu: "); int counter = 1; foreach (MenuItem menu_item in MenuRepository.GetList()) { Console.WriteLine($" #{counter}: {menu_item.Name} | 1 @ ${menu_item.Price}"); counter++; } Input("\nPress enter/return when you're done reading the menu "); }
public static void AddOption() { Console.WriteLine(divider); Console.WriteLine("Let's add a menu item."); string name = Input("Give the menu item a name: "); string desc = Input("Give the menu item a short description: "); double price = Math.Round(double.Parse(Input("Give the menu item a price (no dollar signs!): ")), 2); Console.WriteLine(divider); List <string> ingredients = AddIngredients(); Console.WriteLine(divider); MenuRepository.AddMenuItem(new MenuItem(name, desc, price, ingredients)); Console.WriteLine($"{name} has been added to the menu."); Input("Press enter/return "); }
public static void RemoveOption() { Console.WriteLine(divider); Console.WriteLine("Choose a menu item: "); int counter = 1; foreach (MenuItem menu_item in MenuRepository.GetList()) { Console.WriteLine($" [{counter}] {menu_item.Name}"); counter++; } Console.WriteLine($" [{counter}] Cancel"); while (true) { int chosen_num = int.Parse(Input("Input [#]: ")) - 1; if (chosen_num + 1 == counter) { return; } if (chosen_num > MenuRepository.GetList().Count || chosen_num < 0) { continue; } MenuItem removed_item = MenuRepository.GetList()[chosen_num]; MenuRepository.RemoveMenuItem(removed_item); Console.WriteLine(divider); Console.WriteLine($"{removed_item.Name} has been removed."); Input("Press enter/return "); return; } }
public static void ViewOptionVerbose() { Console.WriteLine(divider); Console.WriteLine("Komodo Cafe Menu: "); int counter = 1; foreach (MenuItem menu_item in MenuRepository.GetList()) { Console.WriteLine($" #{counter}: {menu_item.Name} | 1 @ ${menu_item.Price}"); Console.WriteLine($" \"{menu_item.Description}\""); Console.WriteLine($"\n Ingredients: "); foreach (string ingredient in menu_item.Ingredients) { Console.WriteLine($" {ingredient}"); } Console.WriteLine(); counter++; } Input("Press enter/return when you're done reading the menu "); }
static void Main(string[] args) { MenuRepository menuRepo = new MenuRepository(); Menu komodoDragon = new Menu("1", "Komodo Dragon", "A Komodo twist on a chai tea latte", "Milk, Water, Chai Tea, Honey, Vanilla", 3.49m); Menu komocha = new Menu("2", "KoMocha", "A Mocha latte with a fiery twist!", "Milk, Espresso, Ground Cacao, Sugar, Cinnamon, Cayenne Pepper", 4.25m); Menu komodoKoffee = new Menu("3", "Komodo Koffee", "This classic Komodo blend is a customer favorite!", "Water, Fresh-ground Guatemalan coffee beans, natural and artificial flavors", 1.49m); Menu kappuccino = new Menu("4", "Komodo Kappuccino", "A cappuccino with a kick", "Milk, espresso, cinnamon, cayenne pepper", 3.99m); Menu iceDragon = new Menu("5", "Ice Dragon", "Prefer your coffee cold? Select your favorite Komodo blend served blended or poured over ice.", "Water, Fresh-ground Guatemalan coffee beans, natural and artificial flavors", 2.99m); menuRepo.AddDrinkToMenu(komodoDragon); menuRepo.AddDrinkToMenu(komocha); menuRepo.AddDrinkToMenu(komodoKoffee); menuRepo.AddDrinkToMenu(kappuccino); menuRepo.AddDrinkToMenu(iceDragon); bool cont = true; while (cont) { Console.Clear(); Console.WriteLine("What do you want to do? Select a number.\n" + "1) Add drink to menu\n" + "2) Remove drink from menu\n" + "3) View List\n" + "4) Exit"); string userAnswer = Console.ReadLine(); switch (userAnswer) { case "1": while (true) { Console.Clear(); Console.WriteLine("Enter drink number."); string mealNumber = Console.ReadLine(); Console.WriteLine("Enter drink name."); string mealName = Console.ReadLine(); Console.WriteLine("Enter drink description."); string mealDescription = Console.ReadLine(); Console.WriteLine("Enter drink ingredients."); string mealIngredients = Console.ReadLine(); Console.WriteLine("Enter drink price."); string mealPriceString = Console.ReadLine(); decimal mealPrice = decimal.Parse(mealPriceString); Menu newDrink = new Menu(mealNumber, mealName, mealDescription, mealIngredients, mealPrice); menuRepo.AddDrinkToMenu(newDrink); Console.Clear(); Console.WriteLine("Drink has been added! Do you want to add another drink? y/n"); string theAnswer = Console.ReadLine(); if (theAnswer == "y") { } else if (theAnswer == "n") { break; } } break; case "2": while (true) { Console.Clear(); Console.WriteLine("What drink do you want to remove?"); string drinkName = Console.ReadLine(); menuRepo.RemoveDrinkFromMenu(drinkName); Console.Clear(); Console.WriteLine("Drink has been removed! Do you want to remove another drink? y/n"); string theAnswer = Console.ReadLine(); if (theAnswer == "y") { } else if (theAnswer == "n") { break; } } break; case "3": Console.Clear(); menuRepo.printDrinks(); break; case "4": cont = false; Console.Clear(); Console.WriteLine("Happy I could help!"); break; default: break; } Console.ReadLine(); } }
static void Main(string[] args) { Menu meal1 = new Menu(1, "Pancakes", "Golden flapjacks served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: flour, baking powder, milk, eggs, sugar, salt, unsalted butter, vegetable oil, assorted toppings: butter, maple syrup, confectioner's sugar, honey, jams, preserves, whipped cream.", 4.99m); Menu meal2 = new Menu(2, "Waffles", "Crispy, fluffy waffles fresh from the waffle iron served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: eggs, flour, milk, vegetable oil, sugar, baking powder, salt, vanilla extract, assorted toppings: butter, maple syrup, confectioner's sugar, honey, jams, preserves, whipped cream.", 4.99m); Menu meal3 = new Menu(3, "Crepes", "Thin French pastries served sweet or savory with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: flour, salt, eggs, sugar, whole milk, unsalted butter. Sweet: add vanilla extract, fill with jam, honey, sugar, chocolate hazelnut spread, peanut butter, bananas, etc. Savory: no vanilla extract, fill with shrimp or chicken or bacon with assorted vegetables and herbs.", 6.99m); Menu meal4 = new Menu(4, "French Toast", "Bread slices soaked in eggs and milk, and then fried. Served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: eggs, vanilla extract, nutmeg, bread, vegetable oil, milk, cinnamon, salt, unsalted butter, assorted toppings: butter, maple syrup, confectioner's sugar, honey, jams, preserves, whipped cream.", 5.99m); Menu meal5 = new Menu(5, "Oatmeal", "Whole oat grains mixed with your choice of fruit, served with side options of fruit, sausages, eggs, and coffee. Complimentary orange juice.", "Ingredients: whole grain oats, milk, salt, water, honey.", 3.99m); MenuRepository menuRepo = new MenuRepository(); menuRepo.AddItemToList(meal1); menuRepo.AddItemToList(meal2); menuRepo.AddItemToList(meal3); menuRepo.AddItemToList(meal4); menuRepo.AddItemToList(meal5); List <Menu> meals = menuRepo.GetList(); while (true) { Console.WriteLine("Enter the NUMBER you would like to select:\n" + "1. List all menu items.\n" + "2. Add a menu item. \n" + "3. Remove a menu item. \n" + "4. Exit Console. \n"); string optionAsString = Console.ReadLine(); int option = int.Parse(optionAsString); if (option == 1) { foreach (Menu meal in meals) { Console.WriteLine($"Meal Name: {meal.MealName}\n" + $"Menu Number: {meal.MealNumber}\n" + $"Meal Description: {meal.MealDescription}\n" + $"Meal Ingredients: {meal.MealListOfIngredients}\n" + $"Meal Price: {meal.MealPrice} \n"); } } if (option == 2) { while (true) { Console.WriteLine("Enter a meal number: "); int mealnumber = int.Parse(Console.ReadLine()); Console.WriteLine("Enter a meal name: "); string mealname = Console.ReadLine(); Console.WriteLine("Enter a meal description: "); string mealdescription = Console.ReadLine(); Console.WriteLine("Enter the meal ingredients: "); string mealingredients = Console.ReadLine(); Console.WriteLine("Enter a meal price: "); decimal mealprice = decimal.Parse(Console.ReadLine()); Menu userMeal = new Menu(mealnumber, mealname, mealdescription, mealingredients, mealprice); menuRepo.AddItemToList(userMeal); Console.WriteLine("\n Would you like to add another meal item? y/n"); string response = Console.ReadLine(); response = response.ToLower(); if (response == "y") { } else if (response == "n") { break; } } } if (option == 3) { while (true) { Console.WriteLine("What meal would you like to remove? Enter a NUMBER:"); int number = int.Parse(Console.ReadLine()); menuRepo.RemoveItemFromList(number); Console.WriteLine("Do you want to delete another item? y/n"); string response = Console.ReadLine(); response = response.ToLower(); if (response == "y") { } else if (response == "n") { break; } } } if (option == 4) { break; } } }
public static void ChooseAnOption() { while (true) { Console.WriteLine(divider); Console.WriteLine("What would you like to do?"); Console.WriteLine(" [1] Add a menu item"); Console.WriteLine(" [2] Remove a menu item"); Console.WriteLine(" [3] View menu"); Console.WriteLine(" [4] View menu (verbose)"); Console.WriteLine(" [5] Exit program"); while (true) { string choice = Input("Input [#]: "); if (choice == "1") { AddOption(); break; } if (choice == "2") { if (MenuRepository.GetList().Count > 0) { RemoveOption(); } else { Console.WriteLine(divider); Console.WriteLine("You have no menu items yet."); Input("Press enter/return "); } break; } if (choice == "3") { if (MenuRepository.GetList().Count > 0) { ViewOptionSimple(); } else { Console.WriteLine(divider); Console.WriteLine("You have no menu items yet."); Input("Press enter/return "); } break; } if (choice == "4") { if (MenuRepository.GetList().Count > 0) { ViewOptionVerbose(); } else { Console.WriteLine(divider); Console.WriteLine("You have no menu items yet."); Input("Press enter/return "); } break; } if (choice == "5") { Environment.Exit(1); } } } }
static void Main(string[] args) { //Identify Variables MenuItems salad = new MenuItems(1, "Salad", "Cesar Salad", "Lettuce, tomato, cheese, onion, cesar dressing", 4.99); MenuRepository menuRepo = new MenuRepository(); menuRepo.AdditemToMenu(salad); MenuItems chilli = new MenuItems(2, "Chilli", "Red Pepper Chilli", "Cooked ground beef, chilli sauce, red peppers", 2.99); MenuItems cheeseBurger = new MenuItems(3, "Cheeseburger", "ultimate Cheeseburger", "Hamburger bun, two patties, two slices of American cheese, lettuce, ketchup", 8.99); MenuItems hotDog = new MenuItems(4, "Hot Dog", "Hotdog on a hotdog bun", "One cooked hotdog on a hotdog bun with your choice of ketchup or mustard", 2.99); MenuItems banannaPudding = new MenuItems(5, "Pudding", "Bananna Pudding", "Pudding, banannas, vanilla wafers", 3.99); menuRepo.AdditemToMenu(chilli); menuRepo.AdditemToMenu(cheeseBurger); menuRepo.AdditemToMenu(hotDog); menuRepo.AdditemToMenu(banannaPudding); List <MenuItems> items = menuRepo.GetList(); foreach (MenuItems menuItems in items) { Console.WriteLine(menuItems.MealName); } Console.WriteLine(" "); menuRepo.RemoveitemsFromList(chilli); Console.WriteLine("Enter meal #"); int number = Int32.Parse(Console.ReadLine()); foreach (MenuItems menuItem in items) { Console.WriteLine($"MealName: {menuItem.MealName}\n" + $"Meal Number :{menuItem.MealNumber} \n" + $"Description: {menuItem.Description} \n" + $"Ingredients: {menuItem.Ingredients}\n" + $"Price: {menuItem.Price}\n"); } Console.WriteLine("Enter name of food item:"); string userAnswer = Console.ReadLine(); Console.WriteLine("Enter meal number"); int userMealNumber = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter description:"); string userDescription = Console.ReadLine(); Console.WriteLine("Enter ingredients:"); string userIngredients = Console.ReadLine(); Console.WriteLine("Enter price of food item:"); double userPrice = Double.Parse(Console.ReadLine()); MenuItems theItem = new MenuItems(userMealNumber, userAnswer, userDescription, userIngredients, userPrice); menuRepo.AdditemToMenu(theItem); }
static void Main(string[] args) { MenuRepository menuRepo = new MenuRepository(); List <Menu> menu = menuRepo.DisplayList(); string outPut = null; int itemCount = 0; while (true) { //Menu Console.Clear(); Console.Write($"{outPut}" + $"What action would you like to do?\n" + $"1. Add Item to Menu\n" + $"2. View List\n" + $"3. Remove Item\n" + $"4. Exit\n" + $" "); outPut = null; string response = Console.ReadLine(); //AddItem if (response == "1") { Console.Clear(); Console.Write("Enter the name of the item: "); string newName = Console.ReadLine(); Console.Write($"Enter the description for the {newName}: "); string newDesc = Console.ReadLine(); Console.Write($"Enter the list of ingredients for the {newName}: "); string newIngredients = Console.ReadLine(); Console.Write($"Enter the price for the {newName}: "); decimal newPrice = 0m; bool valid = false; while (!valid) { string input = Console.ReadLine(); if (decimal.TryParse(input, out newPrice)) { valid = true; } else { Console.WriteLine("Invalid input, please enter a number."); } } menuRepo.AddItem(newName, newDesc, newIngredients, newPrice); itemCount++; outPut = $"{newName} has been added to the menu as item number {itemCount}.\n"; } //View List else if (response == "2") { Console.Clear(); foreach (var item in menu) { Console.WriteLine($"{item.MealNumber}. {item.MealName}\n" + $" Description: {item.MealDescription}\n" + $" Ingredients: {item.MealIngredients}\n" + $" Price: ${item.MealPrice}\n"); } if (menu.Count() == 0) { Console.WriteLine("The Menu is currently empty."); } Console.ReadLine(); } //Remove Item else if (response == "3") { Console.Clear(); if (menu.Count() == 0) { Console.WriteLine("The Menu is currently empty."); Console.ReadLine(); } else { int num; Console.Write("Enter the menu item number you want to remove: "); bool isNumber = Int32.TryParse(Console.ReadLine(), out num); if (isNumber) { foreach (Menu item in menu) { if (num == item.MealNumber) { Console.Write($"Are you sure you would like to delete {item.MealName} from the menu?\n" + $"(Y/N): "); string delResponse = Console.ReadLine().ToLower(); if (delResponse == "y") { num--; menuRepo.RemoveItem(menu[num]); outPut = $"{item.MealName} has been removed to the menu.\n"; foreach (Menu oldItem in menu) { int spot = menu.IndexOf(oldItem); spot++; oldItem.MealNumber = spot; } itemCount--; } break; } } } else { Console.WriteLine("Invalid input, please enter the menu item ID number"); Console.ReadLine(); } } } else if (response == "4") { break; } else { outPut = "Improper input. Please try again.\n"; } } }
static void Main(string[] args) { Menu Strawberry = new Menu(1, "StrawberryCake", "real fruit goodness", "cake mix, strawberry", 5); Menu Chocolate = new Menu(2, "ChocolateCake", "lava cake", "cake mix, chocolate", 2); Menu Birthday = new Menu(3, "BirthdayCake", "celebrate your day", "sprinkles, cake mix", 4); MenuRepository menuRepo = new MenuRepository(); while (true) { Console.WriteLine("What do you want to do? Pick a number.\n" + "1) Add to List.\n" + "2) View List.\n" + "3). Remove from List."); string userAnswer = Console.ReadLine(); if (userAnswer == "1") { Console.WriteLine("Enter the number of cake:"); int cakenumber = int.Parse(Console.ReadLine()); Console.WriteLine("Enter name of cake"); string cakename = Console.ReadLine(); Console.WriteLine("Enter the description of the cake:"); string cakescription = Console.ReadLine(); Console.WriteLine("Enter the ingredients used to make this cake:"); string cakegredients = Console.ReadLine(); Console.WriteLine("Enter the cost of this cake"); int cakecost = int.Parse(Console.ReadLine()); Menu usercake = new Menu(cakenumber, cakename, cakescription, cakegredients, cakecost); menuRepo.AddItemToList(usercake); } if (userAnswer == "2") { menuRepo.AddItemToList(Strawberry); menuRepo.AddItemToList(Chocolate); menuRepo.AddItemToList(Birthday); List <Menu> cakes = menuRepo.GetList(); Console.WriteLine("Press enter to view the menu list:"); Console.ReadLine(); foreach (Menu cake in cakes) { Console.WriteLine($"Meal Number: {cake.Number}\n" + $"Name: {cake.Name}\n" + $"Description: {cake.Description}\n" + $"Ingredients: {cake.Ingredients}\n" + $"Price: {cake.Price}\n"); } } if (userAnswer == "3") { while (true) { Console.WriteLine("Would you like to delete a cake off the menu?"); string theAnswer = Console.ReadLine(); if (theAnswer == "y") { Console.WriteLine("What cake you want to remove?"); string Name = Console.ReadLine(); menuRepo.RemoveItemFromList(Name); } if (theAnswer == "n") { break; } } } Console.ReadLine(); } }
static void Main(string[] args) { MenuRepository menuList = new MenuRepository(); List <MenuItem> menuItems = menuList.ProduceMenu(); MenuItem arrozConPollo = new MenuItem(1, "Arroz con Pollo", "Mexican rice with grilled chicken and white cheese.", "Rice, Chicken, Cheese, Spices.", 12.0m); MenuItem macNCheese = new MenuItem(2, "Mac N' Cheese", "Kraft macaroni and cheese", "Macaroni pasta, milk, butter, powdered cheese mix.", 1.50m); MenuItem hambuger = new MenuItem(3, "Flame-grilled Hamburger", "Delicious burger grilled over open flame lightly seasoned.", "Ground beef, brioche bun, sal, pepper, rosemary, butter.", 14.0m); menuList.AddItemToMenu(arrozConPollo); menuList.AddItemToMenu(macNCheese); menuList.AddItemToMenu(hambuger); string response = "0"; while (response != "4") { Console.WriteLine($"Menu Options \n 1. Add Menu Item \n 2. Remove Menu Item \n 3. Print Menu \n 4. Finish"); response = Console.ReadLine(); Console.Clear(); if (response == "1") { Console.Clear(); Console.WriteLine("Menu item number: "); var number = Console.ReadLine(); var mealNum = Int32.Parse(number); Console.WriteLine("Meal name: "); string mealName = Console.ReadLine(); Console.WriteLine("Meal description: "); var description = Console.ReadLine(); Console.WriteLine("Meal price: "); string priceString = Console.ReadLine(); decimal price = decimal.Parse(priceString); bool ingredientsLoop = true; List <String> _ingredientsFromConsole = new List <string>(); while (ingredientsLoop) { Console.WriteLine("Name an ingredient: "); var ingredient = Console.ReadLine(); _ingredientsFromConsole.Add(ingredient); Console.WriteLine("Would you like to add another ingredient? y/n"); var addIngredientResponse = Console.ReadLine(); if (addIngredientResponse == "n") { ingredientsLoop = false; } } StringBuilder builder = new StringBuilder(); foreach (string ingredient in _ingredientsFromConsole) { builder.Append(ingredient).Append(", "); } builder.Length -= 2; string result = builder.ToString(); MenuItem newMenuItem = new MenuItem() { MealNumber = mealNum, MealName = mealName, Description = description, Ingredients = result, MealPrice = price }; menuList.AddItemToMenu(newMenuItem); Console.Clear(); } else if (response == "2") { Console.Clear(); Console.WriteLine("Which item number should be removed?"); var removalNum = Int32.Parse(Console.ReadLine()); foreach (MenuItem meal in menuItems) { if (meal.MealNumber == removalNum) { menuList.RemoveItemFromMenu(meal); break; } } Console.Clear(); } else if (response == "3") { foreach (MenuItem meal in menuItems) { Console.WriteLine($"Menu item: {meal.MealName} \n Meal Number: {meal.MealNumber} \n Description: {meal.Description} \n Ingredients: {meal.Ingredients} \n Price: {meal.MealPrice}"); } Console.WriteLine("Press 'Enter' to return to menu."); Console.ReadLine(); Console.Clear(); } } }