示例#1
0
        //Takes string and returns Soda object.
        private Can GetSodaFromInventory(string nameOfSoda)
        {
            Can soda = _inventory.Find(item => item.Name == nameOfSoda);

            return(soda);
        }
示例#2
0
 public static void PriceOfSoda(Can soda)
 {
     Console.WriteLine("The price of {0} is {1}", soda.name, soda.Cost);
 }
示例#3
0
        //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)
        {
        }
示例#4
0
 //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));
 }
示例#6
0
 public double DrinkSelection(Card card)
 {
     chosenCan = UserInterface.SelectDrink(inventory);
     return(CanPriceMinusCardBalance(chosenCan, card));
 }
示例#7
0
        //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);
        }
示例#8
0
 //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);
 }
示例#10
0
        //reuse this method when customer gives too much money

        public void AddCanstoBackPack(Can canDispensedFromMachine, Backpack backpack)
        {
            inventory.Remove(canDispensedFromMachine);
            backpack.cans.Add(canDispensedFromMachine);
        }
示例#11
0
        //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
        }
示例#12
0
 public void DispenseSodaToCustomer(Customer customer, Can selection)
 {
     RemoveCan(selection);
     customer.backpack.cans.Add(selection);
 }
示例#13
0
        public double CanPriceMinusCardBalance(Can chosenCan, Card card)
        {
            double result = card.AvailableFunds - chosenCan.Cost;

            return(Math.Round(result, 2));
        }
示例#14
0
 //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");
 }
示例#15
0
 //Dispenses Can from Soda Machine to Backpack
 public void DistributeCan(Can can, Customer customer)
 {
     customer.backpack.AddCanToBackpack(can);
     inventory.Remove(can);
 }
示例#16
0
 //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)
     {
     }
 }
示例#17
0
 public void DispenseCans(Can can)
 {
     inventory.Remove(can);
 }
示例#18
0
 public void DispenseSoda(Can canSelection)
 {
     inventory.Remove(canSelection);
     Interface.DisplayMessage($"Successfully purchased {canSelection.Name}!");
 }
示例#19
0
 public void AddSodaToBackpack(Can can)
 {
     backpack.cans.Add(can);
 }
示例#20
0
 //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");
 }
示例#21
0
 public double DrinkSelection(List <Coin> insertedCoins)
 {
     chosenCan = UserInterface.SelectDrink(inventory);
     return(CanPriceMinusCoinsInserted(chosenCan, insertedCoins));
 }