public void Weather_WithinRangeIndex_SetsCondition() { Weather weather = new LemonadeStand.Weather(); //arrange string expected = "sunny"; string actual; //act actual = weather.weatherConditionPossibilities[0]; //assert Assert.AreEqual(actual, expected); }
public override bool BuyLemonade(Weather weather, Player player, Random rand) { bool decision = DecideToBuyLemonade(weather, player, rand); return(decision); }
public void DayLoop(Inventory inventory, Weather weather) { // loop each customer object through a sales calculation that determines if they buy lemonade or not Console.Clear(); Console.WriteLine("How much would you like to sell each cup for?"); lemonadePrice = player.DoubleInputTest(); if (lemonadePrice == 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(errorMessage + "Please enter in a valid price"); Console.ReadKey(); Console.ResetColor(); InitializeDay(player, inventory); } else if (recipeList[0] == 0 || recipeList[1] == 0 || recipeList[2] == 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(errorMessage + "one or more ingrediants are not set."); Console.ReadKey(); Console.ResetColor(); DayLoop(inventory, weather); } else { Random rngCustomerCount = new Random(); int customerCount = 0; if (weather.actualWeather == "Sunny" || weather.actualWeather == "Partly Cloudy") { customerCount = rngCustomerCount.Next(50, 101); } else if (weather.actualWeather == "Cloudy" || weather.actualWeather == "Foggy") { customerCount = rngCustomerCount.Next(30, 86); } Console.WriteLine("Building Customer List, please wait..."); while (customerCount >= customerList.Count) { // building list of customers that will be check if they want to buy lemonade Customer customer = new Customer(0, 0); customer.Creation(weather); customerList.Add(customer); } Console.WriteLine("Customer List completed."); foreach (var item in customerList) { if (item.maxExpectedPrice <= lemonadePrice) { salesCounter++; } else { if (salesCounter >= 15) { Random rngSaleOverride = new Random(); int SaleOverride = rngSaleOverride.Next(1, 101); System.Threading.Thread.Sleep(20); if (SaleOverride <= item.temptation) { salesCounter++; } } } } // math below is calculating the netLoss based on ingrediants used during the day var pitchersMade = Math.Ceiling((Convert.ToDecimal(salesCounter)) / 10); double lemonsUsed; double iceCubesUsed; double sugarUsed; lemonsUsed = (recipeList[0] * Convert.ToInt32(pitchersMade)); iceCubesUsed = (recipeList[1] * Convert.ToInt32(pitchersMade)); sugarUsed = (recipeList[2] * Convert.ToInt32(pitchersMade)); netLoss = ((lemonsUsed * 0.25) + (Convert.ToDouble(Math.Ceiling((Convert.ToDecimal(iceCubesUsed)) / 50)) * 0.50) + (sugarUsed * 0.20)); netProfit = ((salesCounter * lemonadePrice) - netLoss); GUI.EndOfDayReport(inventory, salesCounter, lemonadePrice, netLoss); Console.WriteLine("\n" + "Press any key to continue."); Console.ReadKey(); } dayCounter++; InitializeDay(player, inventory); }
static void Main(string[] args) { string userName; string standLocation; float price; int quantityCups; bool gameCheck = false; double customerFloor; int customerFloorInt; int customerSelling; float sugarSalePrice; float lemonSalePrice; float iceSalePrice; float cupSalePrice; string supplierChoice; int lemonChoice; int iceChoice; int sugarChoice; int cupChoice; float supplyCosts = 0; Supplier selectedSupplier = new Supplier(); var timeOfDay = DateTime.Now.TimeOfDay; var hourOfDay = timeOfDay.Hours; bool timeOfDayCheck; int beginningOfDay = 5; int endOfDay = 20; if (hourOfDay >= beginningOfDay && hourOfDay <= endOfDay) { timeOfDayCheck = true; Console.WriteLine("It's light outside, you can sell lemonade."); } else { timeOfDayCheck = false; Console.WriteLine("It's dark outside, you can't sell lemonade. Come back later when it's light ouside."); Console.ReadLine(); } while (timeOfDayCheck == true) { Console.WriteLine("Welcome to the curb kid."); Console.WriteLine("You'll have to be tough to make it in this business"); Console.WriteLine("You've got one stand, an inventory of cups, lemons, sugar, ice,"); Console.WriteLine("and a lemonade thirsty public."); Console.WriteLine("Nothing comes free or easy, though, and you'll have to purchase and managed your inventory."); Console.WriteLine("You've got a list of suppliers that may offer different prices, and not all of them are located near by."); Console.WriteLine("You'll have to keep an eye on your inventory costs, and shipping times to be sure you're always supplied and always have cash."); Console.WriteLine("Your inventory items will also expire if they're too old."); Console.WriteLine(".. and you'll have to watch your suppliers bottomline."); Console.WriteLine("If they get too low on cash they're out of business, and you lose that supplier option."); Console.WriteLine("The price you set for your lemonade, and the weather will have an important influence on how many people will be willing to buy."); Console.WriteLine(" "); Console.WriteLine("... so if you think you're ready to make some cold hard lemonade cash enter your name, and let's get started:"); Console.Write("Name: "); userName = Console.ReadLine(); Console.Write("Where are you going to set up your stand? "); standLocation = Console.ReadLine(); Player player = new Player(userName, standLocation); //Create initial suppliers and prices for inventory list var supplierNum = new Random(); List <Supplier> supplierList = new List <Supplier> { }; int rInt = supplierNum.Next(2, 5); for (int i = 0; i < rInt; i++) { Supplier supplier = new Supplier(); supplierList.Add(supplier); } //Day Generation while (gameCheck == false) { // Show stats for the day. Console.Clear(); Console.WriteLine("Day " + player.stand.days); Console.WriteLine("Welcome " + player.PlayerName + " Here are your stats"); Console.WriteLine("========================================================"); Console.WriteLine("Cash: " + player.stand.getCash()); Console.WriteLine("Lemons: " + player.stand.getLemonCount()); Console.WriteLine("Ice: " + player.stand.getIceCount()); Console.WriteLine("Sugar: " + player.stand.getSugarCount()); Console.WriteLine("Cups: " + player.stand.getCupCount()); Console.WriteLine(""); // Create New Weather for the day Weather weather = new Weather(); Console.WriteLine("Forecast: The temperature outside is " + weather.Temperature + " and it is " + weather.Precipitation); Console.WriteLine(""); // Show Supplier prices for Supplies Console.WriteLine("Supplier Information"); for (int i = 0; i < rInt; i++) { lemonSalePrice = supplierList[i].getLemonPrice(); cupSalePrice = supplierList[i].getCupPrice(); sugarSalePrice = supplierList[i].getSugarPrice(); iceSalePrice = supplierList[i].getIcePrice(); Console.WriteLine("Name: " + supplierList[i].Name); Console.WriteLine("Sugar Price: " + sugarSalePrice); Console.WriteLine("Lemon Price: " + lemonSalePrice); Console.WriteLine("Ice Price: " + iceSalePrice); Console.WriteLine("Cup Price: " + cupSalePrice); Console.WriteLine(""); } Console.WriteLine("Which supplier would you like to buy from?"); foreach (Supplier supplier in supplierList) { Console.Write(supplier.Name + " | "); } supplierChoice = Console.ReadLine(); bool supplierCheck = false; while (supplierCheck == false) { foreach (Supplier supplier in supplierList) { if (supplier.Name == supplierChoice) { selectedSupplier = supplier; supplierCheck = true; break; } } if (supplierCheck == false) { Console.WriteLine("Supplier not found, please re-enter supplier name."); Console.WriteLine("Which supplier would you like to buy from?"); foreach (Supplier supplier in supplierList) { Console.Write(supplier.Name + " | "); } supplierChoice = Console.ReadLine(); } } //Sugar Purchase Console.WriteLine("How much sugar would you like?<cash on hand: " + player.stand.getCash() + ">"); float supplierSugarPrice = selectedSupplier.getSugarPrice(); string sugarCheckUser = Console.ReadLine(); bool sugarCheck = true; while (sugarCheck == true) { if (Int32.TryParse(sugarCheckUser, out sugarChoice)) { float sugarCost = supplierSugarPrice * sugarChoice; if (sugarChoice >= 0 && sugarCost <= player.stand.getCash()) { SugarOrder sugar = new SugarOrder(Convert.ToInt32(sugarChoice)); Shipment sugarShipment = selectedSupplier.createShipment(sugar); player.stand.addSugarShipment(sugarShipment); player.stand.withdrawCash(sugarCost); supplyCosts += sugarCost; sugarCheck = false; } else { Console.WriteLine("Incorrect Amount. How much sugar would you like?<cash on hand: " + player.stand.getCash() + ">"); sugarCheckUser = Console.ReadLine(); } } else { Console.WriteLine("Invalid number entered. Please enter number in format: #.##"); Console.WriteLine("How much sugar would you like?<cash on hand: " + player.stand.getCash() + ">"); sugarCheckUser = Console.ReadLine(); } } //Cup Purchase Console.WriteLine("How many cups would you like?<cash on hand: " + player.stand.getCash() + ">"); float supplierCupPrice = selectedSupplier.getCupPrice(); string cupCheckUser = Console.ReadLine(); bool cupCheck = true; while (cupCheck == true) { if (Int32.TryParse(cupCheckUser, out cupChoice)) { float cupCost = supplierCupPrice * cupChoice; if (cupChoice >= 0 && cupCost <= player.stand.getCash()) { CupsOrder cups = new CupsOrder(Convert.ToInt32(cupChoice)); Shipment cupShipment = selectedSupplier.createShipment(cups); player.stand.addCupShipment(cupShipment); player.stand.withdrawCash(cupCost); supplyCosts += cupCost; cupCheck = false; } else { Console.WriteLine("Incorrect Amount. How many cups would you like?<cash on hand: " + player.stand.getCash() + ">"); cupCheckUser = Console.ReadLine(); } } else { Console.WriteLine("Invalid number entered. Please enter number in format: #.##"); Console.WriteLine("How many cups would you like?<cash on hand: " + player.stand.getCash() + ">"); cupCheckUser = Console.ReadLine(); } } //Lemon Purchase Console.WriteLine("How many lemons would you like?<cash on hand: " + player.stand.getCash() + ">"); float supplierLemonPrice = selectedSupplier.getLemonPrice(); string lemonCheckUser = Console.ReadLine(); bool lemonCheck = true; while (lemonCheck == true) { if (Int32.TryParse(lemonCheckUser, out lemonChoice)) { float lemonCost = supplierLemonPrice * lemonChoice; if (lemonChoice >= 0 && lemonCost <= player.stand.getCash()) { LemonOrder lemons = new LemonOrder(Convert.ToInt32(lemonChoice)); Shipment lemonShipment = selectedSupplier.createShipment(lemons); player.stand.addLemonShipment(lemonShipment); player.stand.withdrawCash(lemonCost); supplyCosts += lemonCost; lemonCheck = false; } else { Console.WriteLine("Incorrect Amount. How many lemons would you like?<cash on hand: " + player.stand.getCash() + ">"); lemonCheckUser = Console.ReadLine(); } } else { Console.WriteLine("Invalid number entered. Please enter number in format: #.##"); Console.WriteLine("How many lemons would you like?<cash on hand: " + player.stand.getCash() + ">"); lemonCheckUser = Console.ReadLine(); } } //Ice Purchase Console.WriteLine("How much ice would you like?<cash on hand: " + player.stand.getCash() + ">"); float supplierIcePrice = selectedSupplier.getIcePrice(); string iceCheckUser = Console.ReadLine(); bool iceCheck = true; while (iceCheck == true) { if (Int32.TryParse(iceCheckUser, out iceChoice)) { float iceCost = supplierIcePrice * iceChoice; if (iceChoice >= 0 && iceCost <= player.stand.getCash()) { IceOrder ice = new IceOrder(Convert.ToInt32(iceChoice)); Shipment iceShipment = selectedSupplier.createShipment(ice); player.stand.addIceShipment(iceShipment); player.stand.withdrawCash(iceCost); supplyCosts += iceCost; iceCheck = false; } else { Console.WriteLine("Incorrect Amount. How much ice would you like?<cash on hand: " + player.stand.getCash() + ">"); iceCheckUser = Console.ReadLine(); } } else { Console.WriteLine("Invalid number entered. Please enter number in format: #.##"); Console.WriteLine("How much ice would you like?<cash on hand: " + player.stand.getCash() + ">"); iceCheckUser = Console.ReadLine(); } } //Create Lemonade Price Console.WriteLine("What price would you like to sell your lemonade?"); string priceString = Console.ReadLine(); bool priceCheck = true; float floatPrice; while (priceCheck == true) { if (Single.TryParse(priceString, out floatPrice)) { priceCheck = false; price = Convert.ToSingle(priceString); } else { Console.WriteLine("What price would you like to sell your lemonade?"); priceString = Console.ReadLine(); } } price = Convert.ToSingle(priceString); //Create Customers and whether they buy var customerNumber = new Random(); List <Customer> customerList = new List <Customer> { }; List <Customer> customerBuyList = new List <Customer> { }; customerFloor = Math.Floor(weather.DemandLevel); customerFloorInt = Convert.ToInt32(customerFloor); int customerInt = customerNumber.Next(0, customerFloorInt); for (int i = 0; i < customerInt; i++) { Customer customer = new Customer(weather, price, player, player.stand); customerList.Add(customer); } foreach (Customer customer in customerList) { var customerBuy = new Random(); var customerToBuy = customerBuy.Next(0, 100); if (customer.buyChance > customerToBuy) { customerBuyList.Add(customer); } } int minAllowed = player.stand.getMinimumAvailable(); customerSelling = customerBuyList.Count(); Console.WriteLine("How many cups of lemonade would you like to make? <" + minAllowed + "> Max"); string quantityStringCups = Console.ReadLine(); quantityCups = Convert.ToInt32(quantityStringCups); while (quantityCups > minAllowed) { Console.WriteLine("Can't make requested amount, please enter new amount."); Console.WriteLine("How many cups of lemonade would you like to make? <" + minAllowed + "> Max"); quantityCups = Convert.ToInt32(Console.ReadLine()); } int daySold = player.stand.calculateTotalSold(customerSelling); float dayTotal = player.stand.calculateTotal(customerSelling, price); // Update day and display summary player.stand.update(); foreach (Supplier supplier in supplierList) { supplier.update(); } Console.WriteLine("You sold " + daySold + " cups for a total of " + dayTotal + " dollars while spending " + supplyCosts + " on supplies."); Console.WriteLine("You have " + player.stand.getCash() + " remaining."); Console.ReadLine(); // check if game over gameCheck = player.stand.checkifZero(); } } }
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 Day(Weather weather, Player player, Random random) { this.weather = weather; this.player = player; this.random = random; }
//member methods public void GettingDay(Player player, Inventory inventory, Wallet wallet, Customer customer, Weather weather) { inventory = new Inventory(); for (int i = 1; i <= 7; i++) { if (i == 1) { Console.WriteLine("Day 1"); Store Store = new Store(); Store.DisplayingStoreInfo(); weather = new Weather(); weather.gettingTemp(); weather.gettingForecast(); Store.SelectingTypeOfItem(player, inventory, wallet); Recipe recipe = new Recipe(); recipe.GettingPrice(); recipe.GettingLemonsPitcher(inventory, recipe); recipe.GettingSugarPitcher(inventory, recipe); recipe.GettingIcePerCup(inventory, recipe); customer = new Customer(); customer.GettingInitialNumber(); customer.CheckingConditions(recipe, weather, inventory, player); customer.DisplayInformation(); Console.WriteLine("You have: $" + player.amountOfMoney); inventory.displayInventory(); } else if (i == 2) { Console.WriteLine("Day 2"); Store Store = new Store(); weather = new Weather(); weather.gettingTemp(); weather.gettingForecast(); Store.SelectingTypeOfItem(player, inventory, wallet); Recipe recipe = new Recipe(); recipe.GettingPrice(); recipe.GettingLemonsPitcher(inventory, recipe); recipe.GettingSugarPitcher(inventory, recipe); recipe.GettingIcePerCup(inventory, recipe); customer = new Customer(); customer.GettingInitialNumber(); customer.CheckingConditions(recipe, weather, inventory, player); customer.DisplayInformation(); Console.WriteLine("You have: $" + player.amountOfMoney); inventory.displayInventory(); } else if (i == 3) { Console.WriteLine("Day 3"); Store Store = new Store(); weather = new Weather(); weather.gettingTemp(); weather.gettingForecast(); Store.SelectingTypeOfItem(player, inventory, wallet); Recipe recipe = new Recipe(); recipe.GettingPrice(); recipe.GettingLemonsPitcher(inventory, recipe); recipe.GettingSugarPitcher(inventory, recipe); recipe.GettingIcePerCup(inventory, recipe); customer = new Customer(); customer.GettingInitialNumber(); customer.CheckingConditions(recipe, weather, inventory, player); customer.DisplayInformation(); Console.WriteLine("You have: $" + player.amountOfMoney); inventory.displayInventory(); } else if (i == 4) { Console.WriteLine("Day 4"); Store Store = new Store(); weather = new Weather(); weather.gettingTemp(); weather.gettingForecast(); Store.SelectingTypeOfItem(player, inventory, wallet); Recipe recipe = new Recipe(); recipe.GettingPrice(); recipe.GettingLemonsPitcher(inventory, recipe); recipe.GettingSugarPitcher(inventory, recipe); recipe.GettingIcePerCup(inventory, recipe); customer = new Customer(); customer.GettingInitialNumber(); customer.CheckingConditions(recipe, weather, inventory, player); customer.DisplayInformation(); Console.WriteLine("You have: $" + player.amountOfMoney); inventory.displayInventory(); } else if (i == 5) { Console.WriteLine("Day 5"); Store Store = new Store(); weather = new Weather(); weather.gettingTemp(); weather.gettingForecast(); Store.SelectingTypeOfItem(player, inventory, wallet); Recipe recipe = new Recipe(); recipe.GettingPrice(); recipe.GettingLemonsPitcher(inventory, recipe); recipe.GettingSugarPitcher(inventory, recipe); recipe.GettingIcePerCup(inventory, recipe); customer = new Customer(); customer.GettingInitialNumber(); customer.CheckingConditions(recipe, weather, inventory, player); customer.DisplayInformation(); Console.WriteLine("You have: $" + player.amountOfMoney); inventory.displayInventory(); } else if (i == 6) { Console.WriteLine("Day 6"); Store Store = new Store(); weather = new Weather(); weather.gettingTemp(); weather.gettingForecast(); Store.SelectingTypeOfItem(player, inventory, wallet); Recipe recipe = new Recipe(); recipe.GettingPrice(); recipe.GettingLemonsPitcher(inventory, recipe); recipe.GettingSugarPitcher(inventory, recipe); recipe.GettingIcePerCup(inventory, recipe); customer = new Customer(); customer.GettingInitialNumber(); customer.CheckingConditions(recipe, weather, inventory, player); customer.DisplayInformation(); Console.WriteLine("You have: $" + player.amountOfMoney); inventory.displayInventory(); } else { Console.WriteLine("Last Day!"); Store Store = new Store(); weather = new Weather(); weather.gettingTemp(); weather.gettingForecast(); Store.SelectingTypeOfItem(player, inventory, wallet); Recipe recipe = new Recipe(); recipe.GettingPrice(); recipe.GettingLemonsPitcher(inventory, recipe); recipe.GettingSugarPitcher(inventory, recipe); recipe.GettingIcePerCup(inventory, recipe); customer = new Customer(); customer.GettingInitialNumber(); customer.CheckingConditions(recipe, weather, inventory, player); customer.DisplayInformation(); Console.WriteLine("You have: $" + player.amountOfMoney); inventory.displayInventory(); } } }
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); }
public Day() { weather = new Weather(0); dayNames = new List <string>(); }
public void GenerateChancesOfBuying(Weather weather, Recipe recipe, Player player, Random rand) { if (weather.currentWeather == "bad") { if (recipe.lemonadePrice > 0.15m) { int buy = rand.Next(1, 11); if (buy == 1) { player.soldLemonade++; player.inventory.RemoveCupFromInventory(); } } else if (recipe.lemonadePrice < 0.15m) { int buy = rand.Next(1, 4); if (buy == 1) { player.soldLemonade++; player.inventory.RemoveCupFromInventory(); } } } else if (weather.currentWeather == "fair") { if (recipe.lemonadePrice > 0.20m) { int buy = rand.Next(1, 5); if (buy == 1) { player.soldLemonade++; player.inventory.RemoveCupFromInventory(); } } else if (recipe.lemonadePrice <= 0.20m) { int buy = rand.Next(1, 4); if (buy == 1) { player.soldLemonade++; player.inventory.RemoveCupFromInventory(); } } } else if (weather.currentWeather == "good") { if (recipe.lemonadePrice > 0.35m) { int buy = rand.Next(1, 4); if (buy == 1) { player.soldLemonade++; player.inventory.RemoveCupFromInventory(); } } else if (recipe.lemonadePrice <= 0.35m) { int buy = rand.Next(1, 3); if (buy == 1) { player.soldLemonade++; player.inventory.RemoveCupFromInventory(); } } } }
public void CommandCenter(Player user, Store store, Day day, Weather weather) { Console.WriteLine(" "); Console.WriteLine(" *************** Command Center *************** "); Console.WriteLine(" "); Console.WriteLine(" Cups: " + user.inventory.Cups); Console.WriteLine(" Cups of Sugar: " + user.inventory.CupsOfSugar); Console.WriteLine(" Lemons: " + user.inventory.Lemons); Console.WriteLine(" Ice Cubes: " + user.inventory.IceCubes); Console.WriteLine(" "); Console.WriteLine(" Price $" + user.Price); Console.WriteLine(" Money $" + user.Money); Console.WriteLine(" Total Profit: $" + (user.Money - 20)); Console.WriteLine(" "); Console.WriteLine(" Recipe:"); Console.WriteLine(" " + user.LemonsPerCup + " Lemons per a cup"); Console.WriteLine(" " + user.IceCubesPerCup + " Ice Cubes per a Cup"); Console.WriteLine(" " + user.SugarPerCup + " Sugar per a cup"); Console.WriteLine(" "); Console.WriteLine(" Press G to begin"); Console.WriteLine(" Press S to go to the store."); Console.WriteLine(" Press P to change price"); Console.WriteLine(" Press R to change recipe"); Console.WriteLine(" *************** ************** *************** "); switch (GetUserInput()) { case "g": weather.GetWeather(day, random); Console.WriteLine(" "); Console.WriteLine("----------------------------------------------"); Console.WriteLine(" Lets go to market"); Console.WriteLine(" Today's weather " + weather.ActualWeather + " degrees"); Console.WriteLine(" "); Console.WriteLine("----------------------------------------------"); day.AddCustomersToList(weather, day, random, user, inventory); return; case "s": UserInterface.offerInventory(user, store, this, day, weather); break; case "p": Console.WriteLine(" "); Console.WriteLine("Enter price of Lemonade"); user.setPrice(this); UserInterface.DisplayPrice(user); Console.WriteLine(" "); CommandCenter(user, store, day, weather); break; case "r": Console.WriteLine(" "); Console.WriteLine(""); UserInterface.offerRecipeChange(user, store, this, day, weather); CommandCenter(user, store, day, weather); break; default: Console.WriteLine("Please try again"); Console.WriteLine("Be sure to use lower case"); break; } }
public AdultCustomer() { weather = new Weather(); recipe = new Recipe(); }
public Day(Random rng) { Weather weather = new Weather(rng); }
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); } }
public void CheckForCustomer(Player player, Pitcher pitcher, Inventory inventory, Weather weather) { Thread.Sleep(20); int chance = dayRandom.Next(0, 100); if (chance <= 90 && !isRaining) { Customer customer = new Customer(); customer.Randomize(); Console.WriteLine("\n{0} walks by your stand.", customer.GetName()); if (customer.WillBuy(player, weather, pitcher)) { BuyCup(player, pitcher, inventory); if (customer.DetermineIfCustomerWillBuyAgain(pitcher)) { Console.WriteLine("{0} says, 'I'll take another cup please!'", customer.GetName()); BuyCup(player, pitcher, inventory); } } } else { Console.WriteLine("\nThere are no customers right now.\n"); } }
//constructor (BUILD) public Day(Random random) { weather = new Weather(random); customers = new List<Customer>(); NumOfCustomersForDay(random); }
public void ChanceOfBuying(Weather weather) { //if (weather.temperature < 50) { } }
public void RunDay(Player playerOne, Inventory playerInventory, Customer customer, Weather weather) { beginningWampum = playerOne.Money; PopularityAdjuster(playerInventory); CreateCustomers(playerOne, playerInventory, customer, popularity); UserInterface.DisplayInventory(playerOne, playerInventory, beginningWampum); playerInventory.Ice = 0; }
public void CheckForCustomer(Player player, Pitcher pitcher, Inventory inventory, Weather weather) { int chance = dayRandom.Next(0, 100); if (chance <= 80 && !isRaining) { Customer customer = new Customer(); customer.Randomize(); if (customer.WillPurchase(player, weather, pitcher)) { BuyCup(player, pitcher, inventory); if (customer.CheckingCustomerBuyingStatus(pitcher)) { BuyCup(player, pitcher, inventory); } else { Console.WriteLine("No customer walk by..."); } } } else { Console.WriteLine("*The rain is pouring hard so no customer stop to buy any lemonade!*\n"); } }
public Day(Random random) { weather = new Weather(random); }
// constructor public Day() { weather = new Weather(); customerList = new List <string>(); }
public void GenerateTraffic(Weather weather, Player player) { player.lemonadeStand.GenerateFootTraffic(weather); player.lemonadeStand.GeneratePasserbys(weather); }
public void DisplayWeather(Weather weather) { Console.WriteLine("Temperature: {0}", weather.GetTemperature()); Console.WriteLine("Cloudiness: {0}", weather.GetCloudiness()); Console.WriteLine("Chance of Rain: {0}", weather.GetRain()); }
public void CheckWeather(Weather weather) { Console.WriteLine("Welcome to Ryan's Lemonade Stand. Let's sell some lemonade!"); Console.WriteLine($"Today is {weather.Type} with a temperature of {weather.Temperature}F"); Console.WriteLine("Let's go to the store and buy some ingredients."); }
public Player(Weather day, Inventory barn) { Day = day; }
//Today weather public static void TodayWeather(Weather weather) { Console.WriteLine("Today's weather: " + weather.currentWeather); Console.WriteLine("Press enter to continue."); Console.ReadKey(); }
//constructor public Store(Player player, Weather weather) { this.player = player; this.weather = weather; }
public Day(Player player, UserInterface UI, Weather CurrentWeather) { this.player = player; this.UI = UI; this.CurrentWeather = CurrentWeather; }
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 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); } }