//Takes string and returns Soda object. private Can GetSodaFromInventory(string nameOfSoda) { Can soda = _inventory.Find(item => item.Name == nameOfSoda); return(soda); }
public static void PriceOfSoda(Can soda) { Console.WriteLine("The price of {0} is {1}", soda.name, soda.Cost); }
//Member Methods (Can Do) //This method will be the main logic for a customer to retrieve coins form their wallet. //Takes in the selected can for price reference //Will need to get user input for coins they would like to add. //When all is said and done this method will return a list of coin objects that the customer will use a payment for their soda. public List <Coin> GatherCoinsFromWallet(Can selectedCan) { }
//Takes in a can object to add to the customers backpack. public void AddCanToBackpack(Can purchasedCan) { }
//A method to fill the sodamachines inventory with soda can objects. public void FillInventory(Can can, int startingUnits) { _inventory.AddRange(Enumerable.Repeat(can, startingUnits)); }
public double DrinkSelection(Card card) { chosenCan = UserInterface.SelectDrink(inventory); return(CanPriceMinusCardBalance(chosenCan, card)); }
//Gets Can object of matching desired can public Can GetDesiredCan(string canName) { Can desiredCan = inventory.Find(delegate(Can can1) { return(can1.sodaName == canName); }); return(desiredCan); }
//Methods public void AddCanToBackpack(Can can) { cans.Add(can); }
//Takes in a can object to add to the customers backpack. public void AddCanToBackpack(Can purchasedCan) { Backpack.cans.Add(purchasedCan); }
//reuse this method when customer gives too much money public void AddCanstoBackPack(Can canDispensedFromMachine, Backpack backpack) { inventory.Remove(canDispensedFromMachine); backpack.cans.Add(canDispensedFromMachine); }
//Member Methods (Can Do) //This method will be the main logic for a customer to retrieve coins form their wallet. //Takes in the selected can for price reference //Will need to get user input for coins they would like to add. //When all is said and done this method will return a list of coin objects that the customer will use a payment for their soda. public List <Coin> GatherCoinsFromWallet(Can selectedCan) { List <Coin> REturnList = new List <Coin>(); ///place holder next two lines return(REturnList); ///place holder next two lines }
public void DispenseSodaToCustomer(Customer customer, Can selection) { RemoveCan(selection); customer.backpack.cans.Add(selection); }
public double CanPriceMinusCardBalance(Can chosenCan, Card card) { double result = card.AvailableFunds - chosenCan.Cost; return(Math.Round(result, 2)); }
//This is the main method for calculating the result of the transaction. //It takes in the payment from the customer, the soda object they selected, and the customer who is purchasing the soda. //This is the method that will determine the following: //If the payment is greater than the price of the soda, and if the sodamachine has enough change to return: Dispense soda, and change to the customer. //If the payment is greater than the cost of the soda, but the machine does not have ample change: Dispense payment back to the customer. //If the payment is exact to the cost of the soda: Dispense soda. //If the payment does not meet the cost of the soda: dispense payment back to the customer. private void CalculateTransaction(List <Coin> payment, Can chosenSoda, Customer customer) { bool something = RegisterHasCoin("Dime"); }
//Dispenses Can from Soda Machine to Backpack public void DistributeCan(Can can, Customer customer) { customer.backpack.AddCanToBackpack(can); inventory.Remove(can); }
//This is the main method for calculating the result of the transaction. //It takes in the payment from the customer, the soda object they selected, and the customer who is purchasing the soda. //This is the method that will determine the following: //If the payment is greater than the price of the soda, and if the sodamachine has enough change to return: Despense soda, and change to the customer. //If the payment is greater than the cost of the soda, but the machine does not have ample change: Despense payment back to the customer. //If the payment is exact to the cost of the soda: Despense soda. //If the payment does not meet the cost of the soda: despense payment back to the customer. private void CalculateTransaction(List <Coin> payment, Can chosenSoda, Customer customer) { if (true) { } }
public void DispenseCans(Can can) { inventory.Remove(can); }
public void DispenseSoda(Can canSelection) { inventory.Remove(canSelection); Interface.DisplayMessage($"Successfully purchased {canSelection.Name}!"); }
public void AddSodaToBackpack(Can can) { backpack.cans.Add(can); }
//Displays the cost of a can. public static void DisplayCost(Can selectedSoda) { Console.Clear(); Console.WriteLine($"\nYou have selected {selectedSoda.Name}. This option will cost {selectedSoda.Price} \n"); }
public double DrinkSelection(List <Coin> insertedCoins) { chosenCan = UserInterface.SelectDrink(inventory); return(CanPriceMinusCoinsInserted(chosenCan, insertedCoins)); }