using System.Collections.Generic;
public static List<Food> shoppingList = new List<Food>();
public static void Main()
string selection = string.Empty;
Console.WriteLine("1: Enter a food");
Console.WriteLine("2: Show a list of entered food ");
Console.WriteLine("3: Delete a food item");
Console.WriteLine("4: Delete all");
Console.WriteLine("5: Insert at location");
Console.WriteLine("6: Exit");
selection = Console.ReadLine();
bool isOneSelected = selection == "1";
else if(selection == "2")
else if(selection == "3")
else if(selection == "4")
else if(selection == "5")
else if(selection != "6")
Console.WriteLine("You've been bad. Please make a valid selection.");
Console.WriteLine("Thank you for using the 'F00D Sh0pping List' program. have a nice day ;)");
public static Food GetFood()
Console.WriteLine(" Enter a food name:");
string name = Console.ReadLine();
Console.WriteLine(" Enter the quantity of '{0}':" ,name);
int quantity = Convert.ToInt32(Console.ReadLine());
Food randomFood = new Food();
randomFood.Quantity = quantity;
public static void AddFood(Food food)
public static void ShowShoppingList()
Console.WriteLine(" ___________________________");
Console.WriteLine(" ###### Shopping List ######");
Console.WriteLine(" ___________________________");
foreach(Food currentFood in shoppingList)
Console.WriteLine("#{0} Name: {1} Quantity: {2}",addOneNumber, currentFood.Name, currentFood.Quantity);
public static void DeleteAny()
Console.WriteLine("Pick witch item you want to delete");
string usersInputToDelete = Console.ReadLine();
int itemNumberToDelete = -1;
bool isNumber = int.TryParse(usersInputToDelete, out itemNumberToDelete);
shoppingList.RemoveAt(itemNumberToDelete-1);
Console.WriteLine("You've been bad. Please make a valid number.");
public static void InsertAt()
Food newfood = GetFood();
Console.WriteLine("Where do you want to insert at ");
string whereUserWantsToInsertAt = Console.ReadLine();
int whereUserWantsToInsertAt2 = Convert.ToInt32(whereUserWantsToInsertAt)-1;
if(whereUserWantsToInsertAt2 > shoppingList.Count)
Console.WriteLine("You've been bad. Please make a valid selection.");
shoppingList.Insert(whereUserWantsToInsertAt2, newfood);