public bool CheckPitcherRequirements(Pitcher pitcher) { if (lemons.Count >= pitcher.lemonsRequired && cupsOfSugar.Count >= pitcher.cupsOfSugarRequired && iceCubes.Count >= pitcher.iceCubesRequired && cups.Count >= pitcher.cupsPerPitcher) { return(true); } else { return(false); } }
public LemonadeStand(recipe r) { this.pos = 0; money = 15; ingredientsInStock = Lemonade.InstantiateLemonade(); currentRecipe = r; pricePerCup = .25; this.pitcher = new Pitcher(r); pitcher.cups = 0; }
public static void DisplayRecipeContents(Pitcher pitcher, double price) { Console.Clear(); Console.WriteLine(" Current Recipe: "); Console.WriteLine(" ------------------------------------"); Console.WriteLine(" Lemons per pitcher: {0}", pitcher.lemonsRequired); Console.WriteLine(" Cups of Sugar per pitcher: {0}", pitcher.cupsOfSugarRequired); Console.WriteLine(" Ice Cubes per cup: {0}", pitcher.iceCubesRequired); Console.WriteLine(" ------------------------------------"); Console.WriteLine(" Cost per cup: $ {0}", price); }
//can do public void SellLemonade(Player player, Pitcher pitcher) { foreach (Customer potintialPurchaser in customer.AmountOfCustomers) { if (potintialPurchaser.isBuying == true) { player.inventory.cups--; player.inventory.playercash += player.recipe.lemonadePrice; pitcher.cupsToPitcher--; } } }
public void BuyCup(Player player, Pitcher pitcher, Inventory inventory) { player.cash += player.GetPrice(); pitcher.AdjustFull(-10); inventory.RemoveCup(); cashMakeFromSale += player.GetPrice(); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Yay! A customer just bought a cup of lemonade"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("You made ${0} and your pitcher of lemonade is {1}% left.\n", player.GetPrice(), pitcher.GetFull()); Console.ResetColor(); }
public LemonadeStand(recipe r, int pos) { //position it writes to this.pos = pos; money = 15; ingredientsInStock = Lemonade.InstantiateLemonade(); currentRecipe = r; pricePerCup = .25; this.pitcher = new Pitcher(r); pitcher.cups = 0; }
public Player(string name) { this.name = name; this.wallet = new Wallet(); this.recipe = new Recipe(); this.pitcher = new Pitcher(); wallet = new Wallet(); recipe = new Recipe(); pitcher = new Pitcher(); inventory = new Inventory(); }
public void SellLemonade(Player player, Pitcher pitcher, List <Day> daysPlayed, List <double> noOfCustomersBought) { while (pitcher.cupsToPitcher > 0 && player.inventory.lemons > recipe.lemon && player.inventory.sugar > recipe.sugar && player.inventory.ice > recipe.ice) { pitcher.cupsToPitcher--; if (pitcher.cupsToPitcher == 0) { pitcher.InventoryCheck(player, daysPlayed, noOfCustomersBought); pitcher = new Pitcher(player, recipe, daysPlayed, noOfCustomersBought); } } }
public void CreateNewPitcher(Player player) { pitcher = new Pitcher(lemonsForRecipe, sugarForRecipe, iceForRecipe); bool inventoryCheck = player.inventory.CheckPitcherRequirements(pitcher); if (inventoryCheck) { // decrement inventory } else { // not enough inventory } }
public void CustomersPurchaseLemonade(Player player, double pricePerCup, Pitcher pitcher, Weather weather) { //Two paths you can take: //1. customers represents the filtered down customers who will buy (no need for conditional here, just have them buy) //2. customers represents all customers for the day. Only customers with member variable willBuy = true will actually buy lemonade // you can achieve this by if(buying >= 4) { customer willBuy = true} (you will need this in a loop to iterate over all customers foreach (Customer customer in customers) { customer.buyingMultiplier = conditionMultiplier + temperatureMultiplier; if (customer.buyingMultiplier >= 4) { customer.BuyLemonade(player, pitcher, pricePerCup); } } }
//CAN DO //put get methods in store class public void GetNewPitcher(Pitcher pitcher) { for (int i = 1; i <= pitcher.lemonQty; i++) { lemons.RemoveAt(0); } for (int i = 1; i <= pitcher.sugarQty; i++) { sugars.RemoveAt(0); } for (int i = 1; i <= pitcher.iceQty; i++) { icecubes.RemoveAt(0); } }
public bool ChanceCustomerBuys(Pitcher pitcher, Player player, Recipe recipe, Weather weather) { OddsCustomerIsWillingToBuyBasedOnPrice(recipe); OddsCustomerIsWillingToBuyBasedOnRecipe(recipe); OddsCustomerIsWillingToBuyBasedOnTemperature(weather); OddsCustomerIsWillingToBuyBasedOnWeather(weather); if (oddsOnRecipe > 50 && oddsOnTemperature > 50 && oddsOnWeather > 50 && oddsOnPrice > 50) { Console.WriteLine("Bought a cup!"); pitcher.cupsLeftInPitcher -= 1; return(true); } else { Console.WriteLine("Didn't buy a cup. :("); return(false); } }
public void CheckNewPitcher(int cupsSold) { for (int i = 1; i <= cupsSold; i++) { if (cupsSold % 10 == 0) { Pitcher pitcher = new Pitcher(); GetNewPitcher(pitcher); for (int x = 1; x <= 10; x++) { cups.RemoveAt(0); } } else { break; } } }
public bool CheckingCustomerBuyingStatus(Pitcher pitcher) { if (pitcher.GetSweetness() == sweetPercentage || pitcher.GetSourness() == sourPercentage) { return(true); } else if (Math.Abs(pitcher.GetSweetness() - sweetPercentage) <= 20) { return(true); } else if (Math.Abs(pitcher.GetSourness() - sourPercentage) <= 20) { return(true); } else { return(false); } }
public Player() { Console.WriteLine("please enter your name: "); name = Console.ReadLine(); money = 20.00; todaysStartingMoney = money; soldOut = false; cupsSold = 0; inventory = new Inventory(); inventory.cups.count = 0; inventory.lemons.count = 0; inventory.sugar.count = 0; inventory.ice.count = 0; recipe = new Recipe(); recipe.price = 0.1; pitcher = new Pitcher(); }
public bool DetermineIfCustomerWillBuyAgain(Pitcher pitcher) { if (pitcher.GetSweetness() == sweetness || pitcher.GetSourness() == sourness) { Console.WriteLine("{0} says, 'I really, really like this! Perfect!'", name); return(true); } else if (Math.Abs(pitcher.GetSweetness() - sweetness) <= 25) { Console.WriteLine("{0} says, 'Your lemonade is just as sweet as I like it.'", name); return(true); } else if (Math.Abs(pitcher.GetSourness() - sourness) <= 25) { Console.WriteLine("{0} says, 'Your lemonade is just as sour as I like it.'", name); return(true); } else { Console.WriteLine("{0} says, 'Your lemonade is ok.'", name); return(false); } }
public void StartDay(Inventory inventory, Player player, Game game, Weather weather) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("!!~~~~Lemonade Bussiness in Progress~~~!!\n"); Console.ResetColor(); Console.ReadKey(); bool businessIsInProcess = true; bool pitcherIsEmpty = false; bool CupIsOut = false; int timePeriod = 1; Pitcher pitcher = new Pitcher(player); cashMakeFromSale = 0; if (CheckRecipe(inventory, player) == true) { pitcher.Fill(inventory, player); } else { Console.WriteLine("You're missing some supplies!"); Console.WriteLine("Please double check your inventory and recipe"); pitcherIsEmpty = true; businessIsInProcess = false; } while (timePeriod <= numberOfTimePeriods && businessIsInProcess) { if (pitcher.GetFull() <= 10) { Console.WriteLine("You ran out of Lemonade juice!"); Console.WriteLine("Do you want to check if you have enough supplies to make another pitcher?"); string makeAnotherPitcher = Console.ReadLine().ToLower(); if (makeAnotherPitcher == "yes" || makeAnotherPitcher == "y") { if (CheckRecipe(inventory, player) && businessIsInProcess == true) { pitcher.Fill(inventory, player); } else { Console.WriteLine("\nSorry but you don't have enough supplies to make another Pitcher"); } } else if (makeAnotherPitcher == "no" || makeAnotherPitcher == "n") { Console.WriteLine("\n****Today Result****"); Console.WriteLine("press any key to see today result"); Console.ReadKey(); break; } else { try { if (makeAnotherPitcher.Equals("")) { Console.WriteLine("Please choose a valid option"); } } catch { Console.WriteLine("Please choose a valid option"); } } } if (inventory.RetrieveCup() <= 0) { CupIsOut = true; Console.WriteLine("\nOops! seem like you run out of cups. No more business for today."); businessIsInProcess = false; } if (!pitcherIsEmpty && !CupIsOut) { DisplayTime(timePeriod); if (dayRandom.Next(0, 100) <= weather.GetRain()) { isRaining = true; Console.WriteLine("Its Raining"); } else { if (isRaining) { Console.WriteLine("The rain have stop!"); } isRaining = false; } } try { if (inventory.cupStorage.Count() >= 1) { CheckForCustomer(player, pitcher, inventory, weather); } } catch { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nThat was the last lemonade cup on the table!"); Console.ResetColor(); Console.WriteLine("\n~~~*Checking inventory for more cups*~~~"); Console.WriteLine("press any key to see if you have more cup\n"); Console.ReadKey(); } timePeriod++; } EndDayResult(game, player); }
//can do public void RunGame(List <double> noOfCustomersBought) { Start(); GetDays(); while (i <= daysPlayed.Count - 1) { Console.WriteLine("day " + (i + 1)); player.inventory.DisplayCurrentInventory(); Console.WriteLine("Do you want to go to store?"); string shop = Console.ReadLine().ToLower(); switch (shop) { case "yes": { Console.Clear(); store.DisplayPrices(); store.Shopping(player); break; } case "no": { break; } } daysPlayed[i].weather.DisplayWeather(); player.inventory.DisplayCurrentInventory(); player.recipe.DisplayCurrentRecipe(); Console.WriteLine("Would you like to change the current recipe"); string recipechange = Console.ReadLine().ToLower(); switch (recipechange) { case "yes": player.ChooseLemons(); player.ChooseSugar(); player.ChooseIce(); player.PriceofLemonade(); break; case "no": break; } pitcher = new Pitcher(player, player.recipe, daysPlayed, noOfCustomersBought); if (pitcher.cupsToPitcher == 10) { DisplayCustomers(); daysPlayed[i].SellLemonade(player, pitcher); daysPlayed[i].EndDay(noOfCustomersBought); i++; Console.Clear(); } else if (pitcher.cupsToPitcher == 0) { pitcher.InventoryCheck(player, daysPlayed, noOfCustomersBought); pitcher = new Pitcher(player, player.recipe, daysPlayed, noOfCustomersBought); daysPlayed[i].EndDay(noOfCustomersBought); i++; Console.Clear(); } } }
//CTOR public Inventory() { pitcher = new Pitcher(); }
public Booth() { isBoothOpen = false; pitcher = new Pitcher(); }
public Pitcher() { newPitcher = new Pitcher(); }
public void StartDay(Inventory inventory, Player player, Game game, Weather weather) { Console.WriteLine("You start day {0}.", game.GetCurrentDay()); bool dayNotOver = true; bool outOfLemonade = false; bool outOfCups = false; int timePeriod = 1; Pitcher pitcher = new Pitcher(player); dailyIncome = 0; if (dayRandom.Next(0, 100) <= weather.GetRain()) { isRaining = true; Console.WriteLine("It is raining."); } else { isRaining = false; } if (CheckRecipe(inventory, player)) { pitcher.FillPitcher(inventory, player); } else { Console.WriteLine("You can't sell any lemonade today."); outOfLemonade = true; dayNotOver = false; } if (inventory.GetCups() < 1) { Console.WriteLine("You're out of cups! You can't sell any lemonade today."); dayNotOver = false; } while (timePeriod <= numberOfTimePeriods && dayNotOver) { if (pitcher.GetFull() <= 0) { if (CheckRecipe(inventory, player)) { pitcher.FillPitcher(inventory, player); } else { Console.WriteLine("You can't sell any more lemonade today."); outOfLemonade = true; dayNotOver = false; } } if (inventory.GetCups() < 1) { outOfCups = true; Console.WriteLine("You've run out of cups. You can't sell any more lemonade today."); dayNotOver = false; } if (!outOfLemonade && !outOfCups) { Thread.Sleep(2000); DisplayTime(timePeriod); if (dayRandom.Next(0, 100) <= weather.GetRain()) { isRaining = true; Console.WriteLine("It is raining."); } else { if (isRaining) { Console.WriteLine("It has stopped raining."); } isRaining = false; } CheckForCustomer(player, pitcher, inventory, weather); } timePeriod++; } Console.WriteLine("Day {0} is complete.", game.GetCurrentDay()); Console.WriteLine("You spent {0} today.", player.GetMoneySpentToday()); Console.WriteLine("You had a total income of {0}.", dailyIncome); if (dailyIncome - player.GetMoneySpentToday() >= 0) { Console.WriteLine("Your profit today was {0}.", dailyIncome - player.GetMoneySpentToday()); } else { Console.WriteLine("Your loss today was {0}.", dailyIncome - player.GetMoneySpentToday()); } player.totalMoneyEarned += dailyIncome; Console.WriteLine("You have spent {0} total.", player.totalMoneySpent); Console.WriteLine("You have total income of {0}.", player.totalMoneyEarned); if (player.totalMoneyEarned - player.totalMoneySpent >= 0) { Console.WriteLine("Your total profit is {0}.", player.totalMoneyEarned - player.totalMoneySpent); } else { Console.WriteLine("Your total loss is {0}.", player.totalMoneyEarned - player.totalMoneySpent); } }
//constructor (SPAWNER) public Player() { money = 20.00; inventory = new Inventory(); pitcher = new Pitcher(); }
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 + "."); } }
public Inventory(Recipe recipe) { this.recipe = recipe; pitcher = new Pitcher(); }
// constructor (SPAWNER) public Player() { inventory = new Inventory(); wallet = new Wallet(); pitcher = new Pitcher(); }
//have customer preferences determined by randomization public void BuyLemonade(Player player, Pitcher pitcher, double pricePerCup) { pitcher.cupsLeftInPitcher--; player.wallet.Money += pricePerCup; }