Ejemplo n.º 1
0
        //add sugar
        public void BuySugar(string question)
        {
            inventory.sugar.Clear();
            int sugar = PromptInputNumber(question, TestNumber);

            for (int i = 0; i < sugar; i++)
            {
                inventory.AddSugar();
            }
        }
Ejemplo n.º 2
0
        public void BuyItems()
        {
            User_Interface.MenuMessage = "What would you like to buy? ('lemons', 'cups', 'ice', 'sugar', or 'finish' to finish)";
            User_Interface.DisplayMessage();
            switch (Console.ReadLine())
            {
            case "lemons":
                User_Interface.MenuMessage = "How many would you like to buy? 15 cents each.";
                User_Interface.DisplayMessage();
                inventory.AddLemons(Convert.ToInt32(Console.ReadLine()));
                money -= (Lemon.price * inventory.numberOfLemons.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "cups":
                User_Interface.MenuMessage = "How many would you like to buy? 4 cents each.";
                User_Interface.DisplayMessage();
                inventory.AddCups(Convert.ToInt32(Console.ReadLine()));
                money -= (Cup.price * inventory.numberOfCups.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "ice":
                User_Interface.MenuMessage = "How many would you like to buy? 1 cent each.";
                User_Interface.DisplayMessage();
                inventory.AddIce(Convert.ToInt32(Console.ReadLine()));
                money -= (Ice.price * inventory.numberOfIceCubes.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "sugar":
                User_Interface.MenuMessage = "How many would you like to buy? 10 cents each.";
                User_Interface.DisplayMessage();
                inventory.AddSugar(Convert.ToInt32(Console.ReadLine()));
                money -= (Sugar.price * inventory.numberOfSugar.Count);
                DisplayMoney();
                BuyItems();
                break;

            case "finish":
                break;

            //case "removesugar":
            //    inventory.RemoveSugar(Convert.ToInt32(Console.ReadLine()));
            //    break;
            default:
                Console.WriteLine("Invalid Input");
                BuyItems();
                break;
            }
        }
Ejemplo n.º 3
0
        private void RefillSugar()
        {
            Console.WriteLine("Sugar: ");
            int sugarAmount = int.Parse(Console.ReadLine());

            if (sugarAmount != 0)
            {
                if ((sugarAmount * new Sugar().Price) > player1.Store.Money)
                {
                    Console.WriteLine("You don't have enough money to buy that many cubes of sugar. Please try again.");
                    UserInterface.DisplayCash(player1);
                    RefillSugar();
                }
                else
                {
                    inventory.AddSugar(sugarAmount);
                    dailyExpenses += (sugarAmount * new Sugar().Price);
                    money         -= (sugarAmount * new Sugar().Price);
                }
            }
        }
Ejemplo n.º 4
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();
            }
        }