예제 #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}");
                }
            }
        }
예제 #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);
        }
예제 #3
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);
 }