Ejemplo n.º 1
0
    public static void AddToMenu(string menuName)
    {
        menuName = menuName.ToLower();

        Write("Enter the item you would like to add: ");
        string nameItem = ReadLine();

        if (nameItem != "")
        {
            Write($"Enter the price for {nameItem}: $");
            decimal.TryParse(ReadLine(), out decimal itemPrice);
            if (itemPrice <= 0)
            {
                WriteLine("This is not an acceptable price. Please try again.");
            }
            else
            {
                WriteLine($"{nameItem} is {itemPrice:C2}");
                if (menuName == "breakfast")
                {
                    Breakfast_Menu.AddToMenu(itemPrice, nameItem);
                }
                else if (menuName == "lunch")
                {
                    Lunch_Menu.AddToMenu(itemPrice, nameItem);
                }
                else if (menuName == "dinner")
                {
                    Dinner_Menu.AddToMenu(itemPrice, nameItem);
                }
            }
        }
        else
        {
            WriteLine("You did not enter an item to add.");
        }
    }