示例#1
0
        public void GetIngredients(Store store)
        {
            Console.WriteLine("How many cups would you like?");
            string userInputCup = Console.ReadLine();
            int    cupsPurchased;

            cupsPurchased = Int32.Parse(userInputCup);
            inventory.BuyCups(store.SellCups(cupsPurchased, bank));

            Console.WriteLine("How many lemons?\n");
            string userInputLemon = Console.ReadLine();
            int    lemonsPurchased;

            lemonsPurchased = Int32.Parse(userInputLemon);
            inventory.BuyLemons(store.SellLemons(lemonsPurchased, bank));

            Console.WriteLine("How many cups of sugar?\n");
            string userInputSugar = Console.ReadLine();
            int    sugarPurchased;

            sugarPurchased = Int32.Parse(userInputSugar);
            inventory.BuySugar(store.SellSugar(sugarPurchased, bank));

            Console.WriteLine("And, finally, how much ice?\n");
            string userInputIce = Console.ReadLine();
            int    icePurchased;

            icePurchased = Int32.Parse(userInputIce);
            inventory.BuyIce(store.SellIce(icePurchased, bank));

            Console.WriteLine($"So, for today you have {cupsPurchased} cups, {lemonsPurchased} lemons, {sugarPurchased} cups of sugar and {icePurchased} ice cubes. Now, let's make your lemonade recipe!\n");
        }