/// <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(); } }
/// <summary> /// reduces the number of cans /// </summary> public int ReduceCan() { amount--; if (amount <= 0) { soldOutLt.TurnOn(); } canD.Actuate(); return(price); }
public void Purchase() { if (purchasableLight.IsOn()) { if (controller.TryToReturnChange(this.price)) { canDispenser.Actuate(); numCans--; if (numCans == 0) { soldoutLight.TurnOn(); } } } }
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(); } } }
/// <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(); } }
/// <summary> /// Purchase method that dispenses can and ajdusts inventory /// </summary> public void Purchase() { quantityAvailable--; canDispenser.Actuate(); }
public void Dispense() { CanDispenser.Actuate(); }
public void dispenseCan() { productCanDispenser.Actuate(); }