public double BuySugarCubes(Money money, Inventory inventory, Customer customer, Recipe recipe, Weather weather, Game game, Store store, Day day) { Console.WriteLine("You currently have {0} sugar cubes.", inventory.amountOfSugarCubes); Console.WriteLine("Sugar cubes costs .40 per sugar cube."); Console.WriteLine("How many sugar cubes would you like to buy?"); try { numberOfSugarCubes = int.Parse(Console.ReadLine()); } catch (FormatException) { Console.WriteLine("Please enter a positive whole number, or zero"); return(BuySugarCubes(money, inventory, customer, recipe, weather, game, store, day)); } if (money.moneyLeft - (numberOfSugarCubes * .40) < 0) { Console.WriteLine("Sorry you do not have enough money to make that purchase. Please try again."); BuySugarCubes(money, inventory, customer, recipe, weather, game, store, day); } else { inventory.amountOfSugarCubes = inventory.amountOfSugarCubes + numberOfSugarCubes; money.moneyLeft = money.moneyLeft - (numberOfSugarCubes * .1); Console.WriteLine("You have purchased {0} sugar cubes", numberOfSugarCubes); money.ShowMoney(customer, inventory, money, recipe); customer.PotentialCustomers(inventory, money, recipe, weather, customer, game, store, day); } return(money.moneyLeft); }
public void RunGame() { GameRules(); int numberOfDays = ChooseDays(); for (int i = 0; i < numberOfDays; i++) { IngredientPrices(player.bank); player.GetIngredients(store); player.RecipeDecision(); weather.GenerateWeather(); player.CostOfLemonade(); int sales = customer.PotentialCustomers(weather, player).Count; day.DailyLemonadesPurchased(sales); day.DisplayDailyProfits(); player.inventory.CurrentInventory(); } }
public void BuySupplies(Money money, Inventory inventory, Store store, Customer customer, Recipe recipe, Weather weather, Game game, Day day) { Console.WriteLine("You have {0} dollars.", money.moneyLeft); Console.WriteLine("You currently have {0} lemons, {1} ice cubes, {2} sugar.", inventory.amountOfLemons, inventory.amountOfIceCubes, inventory.amountOfSugarCubes); Console.WriteLine("Would you like to buy more supplies for your lemonade stand? 'Yes' or 'No.'"); string userInput = Console.ReadLine(); if (userInput.ToLower() == "yes") { Console.WriteLine("Time to go to the store!"); store.BuyLemons(money, inventory, customer, recipe, weather, game, store, day); } else if (userInput.ToLower() == "no") { Console.WriteLine("Time to sell some lemonade!"); customer.PotentialCustomers(inventory, money, recipe, weather, customer, game, store, day); } else { Console.WriteLine("Error. Please enter 'yes' or 'no'."); BuySupplies(money, inventory, store, customer, recipe, weather, game, day); } }