Exemplo n.º 1
0
        public void SellProduct(BasicRecipe product, Weather weather)
        {
            Console.WriteLine($"Today will be {weather.Type} with a temperature of {weather.Temperature}F");
            Console.WriteLine("How much would you like to sell your lemonade for today?");
            double price = Validation.ReadDoubleLine();

            Console.Clear();
            Console.WriteLine("Selling lemonade...");
            Console.ReadLine();
            Console.Clear();

            double dayProfit = 0;

            for (int i = 0; i < CustomerCountLogic.CustomerLogic(weather); i++)
            {
                Customer customer = new Customer();
                if (customer.GonnaBuy(price))
                {
                    dayProfit += price + product.setting;
                    Inventory.AddToBalance(price + product.setting);
                }
            }

            Console.Clear();
            Console.WriteLine($"Today, you spent ${Math.Round(dayLoss, 2)} at the store for ingredients, " +
                              $"and made ${Math.Round(dayProfit, 2)}. Profit/Loss for today: ${Math.Round(dayProfit + dayLoss, 2)}");
            Console.WriteLine("What a long day. Take a break and try again tomorrow. Press Enter to get some sleep.");
            Console.ReadLine();
            Console.WriteLine("Nap time...");
            Console.ReadLine();
            Console.Clear();
        }
Exemplo n.º 2
0
        public void BuyIngredients()
        {
            Console.WriteLine($"You have ${Inventory.Balance}");
            Console.WriteLine("Choose an item to buy from the store.");
            Console.WriteLine($"1. Store bought lemonade. Price: ${BasicRecipe.GetCost()}");
            Console.WriteLine($"2. Lemon. Price: ${Store.LemonPrice}");
            Console.WriteLine($"3. Sugar Packets. Price: ${Store.SugarPrice}");
            Console.WriteLine($"4. Ice Cubes. Price: ${Store.IcePrice}");
            Console.WriteLine($"5. Done shopping.");

            while (true)
            {
                Console.WriteLine("What would you like to buy? ");
                int userInput = Validation.ReadUserInput(5);
                switch (userInput)
                {
                case 1:
                {
                    BuyItem((count) => { Inventory.BuyBasicRecipe(count); dayLoss -= count * BasicRecipe.GetCost(); }, BasicRecipe.GetCost());
                    break;
                }

                case 2:
                {
                    BuyItem((count) => { Inventory.BuyLemon(count); dayLoss -= count * Store.LemonPrice; }, Store.LemonPrice);
                    break;
                }

                case 3:
                {
                    BuyItem((count) => { Inventory.BuySugar(count); dayLoss -= count * Store.SugarPrice; }, Store.SugarPrice);
                    break;
                }

                case 4:
                {
                    BuyItem((count) => { Inventory.BuyIce(count); dayLoss -= count * Store.IcePrice; }, Store.IcePrice);
                    break;
                }

                case 5:
                {
                    return;
                }
                }
            }
        }