Ejemplo n.º 1
0
        static void RequestUserAction()
        {
            Console.WriteLine(" What action would you like to use?\n   1 - Print Machine and Buyer credit Info, \n   2 - Put money to Buyer Credit, \n   3 - Refill Machine, \n   4 - Purchase a Product\n HINT: Type EXIT to disconnect from the system and get your change.");
            string userInput = Console.ReadLine();

            switch (userInput)
            {
            case "1":
                PrintColored(vendingMachine.ToString(), ConsoleColor.Green);
                break;

            case "2":
                vendingMachine.AddMoney();
                break;

            case "3":
                vendingMachine.RefillItems();
                break;

            case "4":
                ProductPurchase();
                break;

            case "EXIT":

                vendingMachine.ReturnMoney();
                Console.WriteLine("Press any key to exit");
                Console.ReadLine();

                Environment.Exit(0);
                break;

            default:
                break;
            }
            RequestUserAction();
        }