Ejemplo n.º 1
0
        public static void Main(String[] args)
        {
            string coinInput = "";

            Console.WriteLine("Welcome to the Vending Machine!!!");
            Console.WriteLine("This Machine only accepts Nickles, Dimes, and Quarters");
            Console.WriteLine("To insert change just type out the name of the coin you wish to enter");
            VendingMachine vm = new VendingMachine();

            do
            {
                Console.WriteLine("Type \"vend\" to begin vending process or \"exit\" to leave");
                Console.WriteLine(vm.CheckDisplay());
                coinInput = Console.ReadLine();
                if (coinInput.ToLower() == "vend")
                {
                    Console.WriteLine("Please enter a number 0 - " + (vm.products.Length - 1));
                    int prodID = Int32.Parse(Console.ReadLine());
                    Console.WriteLine(vm.Dispense(prodID));
                }
                else
                {
                    Console.WriteLine(vm.InsertCoin(coinInput));
                }
            } while (coinInput != "exit");
        }