Exemplo n.º 1
0
        private void BuyItem(Action <double> buyAction, double price)
        {
            Console.WriteLine("How many would you like to buy?");
            double amount = Validation.ReadDoubleLine();

            if (Inventory.CanBuy(amount * price))
            {
                buyAction.Invoke(amount);
                Console.WriteLine($"You have ${Inventory.Balance} left.");
            }
            else
            {
                Console.WriteLine("Sorry, you're broke as a joke.");
            }
        }