Beispiel #1
0
        public void Resupply(Inventory inventory)
        {
            Console.WriteLine("What do you need? Enter 'paper cups', 'lemons', 'sugar', or 'ice cubes'");
            string UserInput    = Console.ReadLine();
            bool   IsInputValid = false;

            while (!IsInputValid)
            {
                string input = UserInput;
                switch (UserInput)
                {
                case "paper cups":
                    IsInputValid = true;
                    inventory.AddPaperCups();
                    break;

                case "lemons":
                    IsInputValid = true;
                    inventory.AddLemons();
                    break;

                case "sugar":
                    IsInputValid = true;
                    inventory.AddSugar();
                    break;

                case "ice cubes":
                    IsInputValid = true;
                    inventory.AddIceCubes();
                    break;

                default:
                    return;
                }
                inventory.PlayerTotals();
            }
        }