Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            VendingMachine        vm          = new VendingMachine();
            List <Product>        productList = ProductList.GenerateProducts();
            Random                rnd         = new Random();
            Dictionary <int, int> moneyAtHand = new Dictionary <int, int>();

            for (int i = 0; i < vm.cashValues.Length; i++)
            {
                moneyAtHand.Add(vm.cashValues[i], rnd.Next(1, 10));
            }

            bool menuActive = true;

            while (menuActive)
            {
                Console.Clear();
                WelcomeMenu();
                string input = Console.ReadLine();
                switch (input)
                {
                case "1":
                    vm.Deposit(DepositMenu(moneyAtHand));
                    break;

                case "2":
                    Console.WriteLine($"You have {vm.MoneyPool}kr to shop for.");
                    Console.ReadKey();
                    break;

                case "3":
                    ShopMenu(vm, ref productList);
                    break;

                case "4":
                    MyItems();
                    break;

                case "5":
                    WithdrawMenu(vm.Withdraw(), ref moneyAtHand);
                    break;

                case "6":
                    menuActive = false;
                    break;

                default:
                    break;
                }
            }
        }