using System.Collections.Generic;
public class shoppingList {
public void display (string[] essential, List<string> regular) {
foreach(var item in essential) {
Console.WriteLine(co + ". " + item.ToString());
Console.WriteLine($"[{unt} slots remaining]");
Console.WriteLine("\nRegular Items (Dynamic)");
foreach(var item in regular) {
Console.WriteLine(co1 + ". " + item.ToString());
public void searchItem (string[] essential, List<string> regular, string find) {
bool check = regular.Contains(find);
index = regular.IndexOf(find);
Console.Write(find + " was found in 'Regular Items' at " + index + ". " + found + "\n");
index = Array.IndexOf(essential, find);
found = essential[index];
Console.Write(find + " was found in 'Essential Items' at " + index + ". " + found + "\n");
public static void Main()
string[] essential = { "Bread", "Milk", "Egg" };
shoppingList s = new shoppingList();
List<string> regular = new List<string> {"Apples", "Coffee", "Cookies", "Tea"};
Console.WriteLine("Shopping List Manager");
Console.WriteLine("---------------------");
s.display(essential, regular);
Console.Write("\nEnter command (1-Add, 2-Remove, 3-Search, 4-Display, 5-Exit): ");
int choice = Convert.ToInt32(Console.ReadLine());
Console.Write("Add to (1-Essential, 2-Regular): ");
int addto = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter item: ");
additem = Console.ReadLine();
Console.WriteLine($"Added to Essential Items!");
foreach(var item in essential)
Console.WriteLine($"{co}");
essential = essential.Append(additem).ToArray();
Console.Write("\nEssential List is Full\n");
Console.WriteLine($"Added to Regular Items!");
Console.WriteLine("\nCurrent Lists: ");
s.display(essential,regular);
Console.Write("Enter item: ");
string remove = Console.ReadLine();
Console.WriteLine("Removing from Regular");
Console.WriteLine("\nCurrent Lists: ");
s.display(essential,regular);
Console.Write("Enter item: ");
string find = Console.ReadLine();
s.searchItem(essential, regular, find);
Console.WriteLine("\nCurrent Lists: ");
s.display(essential, regular);
Console.Write("\nEnter command (1-Add, 2-Remove, 3-Search, 4-Display, 5-Exit): ");
choice = Convert.ToInt32(Console.ReadLine());