public static void DisplayLemonadeSold(Day day) { Console.WriteLine("Cups of Lemonade Sold: " + day.customer.purchasingCustomer.Count); }
//constructor public Customer(Player player, Day today, Game game) { DecisionToBuy(player, today, game); }
private void DisplayEndOfDayResults(Player player, Game game, Day currentDay, Weather CurrentWeather, Random random) { Console.WriteLine($"You have sold {cupsSold} cups and now have a total of ${player.playerMoney}"); Console.ReadLine(); UI.MainMenu(player, game, currentDay, CurrentWeather, UI, random); }
public Inventory(Player player, Day day) { this.player = player; this.day = day; }
public void SellLemonade(Day day, Random random) { int willBuy = 0; foreach (Customer buyingCustomer in day.customer.potentialCustomer) { willBuy = random.Next(1, 11); if (lemonade.cupsOfLemonade.Count != 0) { if ((day.weather.temperature >= 70) && (lemonade.LemonadePrice < .50m) && (lemonade.LemonadeType == buyingCustomer.LemonadeTypePreference)) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } else if ((day.weather.temperature >= 70) && (lemonade.LemonadePrice >= .50m) && (lemonade.LemonadeType == buyingCustomer.LemonadeTypePreference)) { if (willBuy > 3) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } } else if ((day.weather.temperature < 70) && (day.weather.temperature >= 40) && (lemonade.LemonadePrice < .50m) && (lemonade.LemonadeType == buyingCustomer.LemonadeTypePreference)) { if (willBuy > 2) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } } else if ((day.weather.temperature < 70) && (day.weather.temperature >= 40) && (lemonade.LemonadePrice >= .50m) && (lemonade.LemonadeType == buyingCustomer.LemonadeTypePreference)) { if (willBuy > 3) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } } else if ((day.weather.temperature < 40) && (lemonade.LemonadePrice < .50m) && (lemonade.LemonadeType == buyingCustomer.LemonadeTypePreference)) { if (willBuy > 4) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } } else if ((day.weather.temperature < 40) && (lemonade.LemonadePrice >= .50m) && (lemonade.LemonadeType == buyingCustomer.LemonadeTypePreference)) { if (willBuy > 6) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } } else if ((day.weather.temperature >= 70) && (lemonade.LemonadePrice < .50m) && (recipe.IceCubesQty >= 6)) { if (willBuy > 5) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } } else if ((day.weather.temperature >= 70) && (lemonade.LemonadePrice < .40m)) { if (willBuy > 5) { day.customer.purchasingCustomer.Add(buyingCustomer); lemonade.RemoveLemonade(); } } } else if (lemonade.cupsOfLemonade.Count == 0) { Console.WriteLine("\nSold Out for today"); break; } } }
public void StartGame() { Player.moneyMade = 0; Store.totalCostSpentOnIngredients = 0; Player.dailyProfit = 0; Day.CheckWeatherForecast(); Day DayOfTheWeek = new Day(); DayOfTheWeek.CheckTodaysWeather(); Store.ExploreStore(Player, Inventory); Inventory.DisplayAmountOfEachIngredient(); Console.WriteLine("Now that you have some ingredients, you can set the price and make the recipe for your lemonade. If you need help enter 'help'."); string action = Console.ReadLine(); switch (action) { case "help": Recipe.Help(); break; default: break; } price = Player.SetPrice(); Recipe.GetNumberOfLemonsUsed(Inventory); Recipe.GetNumberOfCupsOfSugarUsed(Inventory); Recipe.GetNumberOfIceCubesPerCup(Inventory); Inventory.lemons -= Recipe.lemons; Inventory.cupsOfSugar -= Recipe.cupsOfSugar; Pitcher Pitcher = new Pitcher(); Pitcher.GetCupsInPitcher(Recipe); counter = 0; secondCounter = 1; int customers = DayOfTheWeek.CountCustomers(Player); int cupsInPitcher = Pitcher.cupsInPitcher; while ((Inventory.paperCups > 0 && Inventory.lemons > 0 && Inventory.cupsOfSugar > 0 && Inventory.iceCubes > 0) && counter < customers) { if (counter >= 0) { if (secondCounter % 10 == 0) { Player.ChangePriceDuringDay(); } secondCounter++; Console.WriteLine("Customer " + (counter + 1)); counter++; Customer Customer = new Customer(); Customer.BuyLemonade(DayOfTheWeek, Player); if (Customer.cupsOfLemonade > Pitcher.cupsInPitcher) { Inventory.paperCups -= Customer.cupsOfLemonade; Inventory.iceCubes -= Customer.cupsOfLemonade * Recipe.iceCubesPerCup; Inventory.GetPaperCupsRemaining(); Inventory.GetIceCubesRemaining(); Customer.cupsOfLemonade -= Pitcher.cupsInPitcher; Pitcher.cupsInPitcher -= Pitcher.cupsInPitcher; Inventory.lemons -= Recipe.lemons; Inventory.cupsOfSugar -= Recipe.cupsOfSugar; Pitcher.cupsInPitcher += cupsInPitcher; Pitcher.cupsInPitcher -= Customer.cupsOfLemonade; } else if (Customer.cupsOfLemonade == Pitcher.cupsInPitcher) { Inventory.paperCups -= Customer.cupsOfLemonade; Inventory.iceCubes -= Customer.cupsOfLemonade * Recipe.iceCubesPerCup; Inventory.GetPaperCupsRemaining(); Inventory.GetIceCubesRemaining(); Pitcher.cupsInPitcher -= Customer.cupsOfLemonade; Inventory.lemons -= Recipe.lemons; Inventory.cupsOfSugar -= Recipe.cupsOfSugar; Pitcher.cupsInPitcher += cupsInPitcher; } else if (Customer.cupsOfLemonade < Pitcher.cupsInPitcher) { Inventory.paperCups -= Customer.cupsOfLemonade; Inventory.iceCubes -= Customer.cupsOfLemonade * Recipe.iceCubesPerCup; Inventory.GetPaperCupsRemaining(); Inventory.GetIceCubesRemaining(); Pitcher.cupsInPitcher -= Customer.cupsOfLemonade; } Player.CalculateTotal(Customer); } } if (Inventory.paperCups == 0 || Inventory.lemons == 0 || Inventory.cupsOfSugar == 0 || Inventory.iceCubes == 0) { Console.WriteLine("You ran out of ingredients and cannot sell anymore lemonade for the rest of the day. Please try again tomorrow."); Console.WriteLine("You made a total of $" + Player.moneyMade + ' ' + "before you ran out of ingredients."); } if (counter >= customers) { Console.WriteLine("The day is over now. You made $" + Player.moneyMade + ' ' + "for the day."); } if (Pitcher.cupsInPitcher > 0) { Inventory.lemons -= Recipe.lemons; Inventory.cupsOfSugar -= Recipe.cupsOfSugar; } if (Inventory.iceCubes > 0) { Console.WriteLine("Your remaining ice cubes have melted."); Inventory.iceCubes -= Inventory.iceCubes; } Inventory.DisplayAmountOfEachIngredient(); Console.WriteLine("You now have" + ' ' + "$" + Player.money + "."); Player.GetDailyProfit(Store); Player.GetTotalRunningProfit(); if (Player.dailyProfit > 0) { Console.WriteLine("You made a profit of" + ' ' + "$" + Player.dailyProfit + ' ' + "for the day."); } else if (Player.dailyProfit < 0) { Console.WriteLine("You went under today and had a loss of" + ' ' + "$" + Player.dailyProfit + ' ' + "for the day."); } if (Player.totalProfit > 0) { Console.WriteLine("For the number of days you have played so far, you have a profit of" + ' ' + "$" + Player.totalProfit + "."); } else if (Player.totalProfit < 0) { Console.WriteLine("For the number od days you have played so far, you have a loss of -" + "$" + Player.totalProfit + "."); } }
//member variables //constructors public Store(Day newDay) { }
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); } }
public static void TodayWeather(Day day) { Console.WriteLine("Today is " + day.weather.temperature + " degrees and it is " + day.weather.condition + ".\n"); }