Ejemplo n.º 1
0
        static void PrintOrder(string menu, int[] currentOrder)
        {
            string[]  useMenu    = new string[20];
            decimal[] menuPrices = new decimal[20];
            if (menu.ToLower() == "breakfast")
            {
                useMenu    = Breakfast_Menu.BreakfastItems();
                menuPrices = Breakfast_Menu.BreakfastPrices();
            }
            else if (menu.ToLower() == "lunch")
            {
                useMenu    = Lunch_Menu.LunchItems();
                menuPrices = Lunch_Menu.LunchPrices();
            }
            else if (menu.ToLower() == "dinner")
            {
                useMenu    = Dinner_Menu.DinnerItems();
                menuPrices = Dinner_Menu.DinnerPrices();
            }

            WriteLine("Your order:");
            for (var i = 0; i < currentOrder.Length; i++)
            {
                int numItems = currentOrder[i];
                if (numItems != 0)
                {
                    WriteLine($"{numItems}   {useMenu[i]}{(menuPrices[i]*numItems):C2}");
                }
            }
        }
Ejemplo n.º 2
0
        static decimal OrderTotal(string menu, int[] order)
        {
            decimal total = 0M;
            decimal tax   = 0M;

            decimal[] menuPrices = new decimal[20];
            if (menu.ToLower() == "breakfast")
            {
                menuPrices = Breakfast_Menu.BreakfastPrices();
            }
            else if (menu.ToLower() == "lunch")
            {
            }
            else if (menu.ToLower() == "dinner")
            {
            }

            for (var i = 0; i < order.Length; i++)
            {
                int numItems = order[i];
                if (numItems != 0)
                {
                    total += menuPrices[i] * numItems;
                }
            }
            tax = total * Manager.TaxRate;
            tax = (Math.Round((tax + 0.005M) * 100)) / 100;
            WriteLine($"Tax ({(Manager.TaxRate):P})           {tax:C2}");
            return(total);
        }
Ejemplo n.º 3
0
 public static string[] FindMenu(string menu)
 {
     string[] checkMenu = new string[20];
     menu = menu.ToLower();
     if (menu == "breakfast")
     {
         checkMenu = Breakfast_Menu.Breakfast();
     }
     else if (menu == "lunch")
     {
         checkMenu = Lunch_Menu.Lunch();
     }
     else if (menu == "dinner")
     {
         checkMenu = Dinner_Menu.Dinner();
     }
     return(checkMenu);
 }
Ejemplo n.º 4
0
 public static decimal[] FindMenuPrices(string menu)
 {
     menu = menu.ToLower();
     decimal[] checkMenu = new decimal[20];
     if (menu == "breakfast")
     {
         checkMenu = Breakfast_Menu.BreakfastPrices();
     }
     else if (menu == "lunch")
     {
         checkMenu = Lunch_Menu.LunchPrices();
     }
     else if (menu == "dinner")
     {
         checkMenu = Dinner_Menu.DinnerPrices();
     }
     return(checkMenu);
 }
Ejemplo n.º 5
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.");
        }
    }
Ejemplo n.º 6
0
    public static void RemoveFromMenu(string menuName)
    {
        menuName = menuName.ToLower();

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

        if (nameItem != "")
        {
            WriteLine($"{nameItem} is being removed.");
            if (menuName == "breakfast")
            {
                Breakfast_Menu.RemoveFromMenu(nameItem);
            }
            else if (menuName == "lunch")
            {
                Lunch_Menu.RemoveFromMenu(nameItem);
            }
            else if (menuName == "dinner")
            {
                Dinner_Menu.RemoveFromMenu(nameItem);
            }
        }
    }