示例#1
0
        static void Main(string[] args)
        {
            string path = Path.Combine(Environment.CurrentDirectory, "vendingmachine.txt");

            Stocker stocker = new Stocker();
            LogFile logFile = new LogFile();

            VendingMachine vendingMachine = new VendingMachine(stocker.ReturnStock(path));

            string input = PromptUserForMenuChoice();

            while (input != "Q")
            {
                //making a change so steve can pull updated program
                switch (input)
                {
                case "1":                         // Display current stock
                    DisplayStock(vendingMachine);
                    break;

                case "2":                         // Make a purchase
                    TransactionMenu menu = new TransactionMenu();
                    menu.PurchaseMenu(vendingMachine);
                    break;

                case "3":                         //check the sales log
                    DisplayLogFile(logFile);
                    break;
                }

                input = PromptUserForMenuChoice();
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            //  Create a vending machine and load it
            VendingMachine VendOMatic = new VendingMachine();
            Stocker        stocker    = new Stocker();

            VendOMatic.Load(stocker.Restock());

            Customer customer = new Customer();
            //  Create a menu object and give it access to VendOMatic and customer
            MainMenu menu = new MainMenu();

            menu.Receive(VendOMatic, customer);
            menu.Run();//   Almost everything happens within the menu object
        }
示例#3
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            Console.SetWindowSize(100, 40);

            Stocker stocker = new Stocker();

            string[] stockList = stocker.GetStock();

            VendingMachine vm = new VendingMachine();

            vm.FillSlots(stockList);
            MainMenu menu = new MainMenu(vm);

            menu.DisplayMainMenu();
        }