Exemplo n.º 1
0
 /// <summary>
 /// Dispenses a can, decreases the number of cans, and turns on soldOutLights accordingly
 /// </summary>
 public void DispenseCan()
 {
     canDispenser.Actuate();
     numberOfDrinks--;
     if (numberOfDrinks == 0)
     {
         soldOutLight.TurnOn();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// reduces the number of cans
 /// </summary>
 public int ReduceCan()
 {
     amount--;
     if (amount <= 0)
     {
         soldOutLt.TurnOn();
     }
     canD.Actuate();
     return(price);
 }
Exemplo n.º 3
0
 public void Purchase()
 {
     if (purchasableLight.IsOn())
     {
         if (controller.TryToReturnChange(this.price))
         {
             canDispenser.Actuate();
             numCans--;
             if (numCans == 0)
             {
                 soldoutLight.TurnOn();
             }
         }
     }
 }
Exemplo n.º 4
0
 public void pushPurchaseButton()
 {
     if (vm.getTotalInsertMoney() >= price && count > 0)
     {
         vm.turnOffPurchaseableLight();
         if (vm.checkIfReturnChange(price))
         {
             count--;
             canDispenser.Actuate();
             if (count == 0)
             {
                 soldOutLight.TurnOn();
             }
             vm.coinDispense();
         }
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// This handles when a can is bought. It removes the can from the count, actuates the dispenser, and then changes the distplay
        /// </summary>
        /// <param name="totalValue">This is the total amount of money the customer has put into the machine</param>
        /// <returns>Returns an int with the price of the can </returns>
        public void CanBought(int totalValue)
        {
            if (count == 0)
            {
                return;
            }
            bool haveEnough = CheckPurchasability(totalValue);

            if (haveEnough != true)
            {
                return;
            }
            count--;
            dispenser.Actuate();
            if (count == 0)
            {
                soldOutLight.TurnOn();
                purchaseableLight.TurnOff();
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Purchase method that dispenses can and ajdusts inventory
 /// </summary>
 public void Purchase()
 {
     quantityAvailable--;
     canDispenser.Actuate();
 }
Exemplo n.º 7
0
 public void Dispense()
 {
     CanDispenser.Actuate();
 }
Exemplo n.º 8
0
 public void dispenseCan()
 {
     productCanDispenser.Actuate();
 }