Exemplo n.º 1
0
        public bool CanSale(int amount)
        {
            //Check if there is a $5 and $10 dollar change available
            //If Yes, remove $5 and $10 bill from the data store and add the $20 to the store. Return true.
            //Else return false.
            bool bReturn = false;

            if (_cashRegister.FindBill(10) > 0 && _cashRegister.FindBill(5) > 0)
            {
                _cashRegister.RemoveBill(5);
                _cashRegister.RemoveBill(10);

                bReturn = true;
            }
            else if (_cashRegister.FindBill(5) > 2)
            {
                _cashRegister.RemoveBill(5);
                _cashRegister.RemoveBill(5);
                _cashRegister.RemoveBill(5);

                bReturn = true;
            }

            _cashRegister.AddBill(20);

            return(bReturn);
        }
Exemplo n.º 2
0
        public bool CanSale()
        {
            //Check if there is a $5 dollar change available
            //If Yes, remove $5 bill from the data store and add the $10 to the store. Return true.

            if (_cashRegister.FindBill(Dollar.FiveDollar) > 0)
            {
                _cashRegister.RemoveBill(Dollar.FiveDollar);
                _cashRegister.AddBill(Dollar.TenDollar);

                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public bool CanSale(int amount)
        {
            //Check if there is a $5 dollar change available
            //If Yes, remove $5 bill from the data store and add the $10 to the store. Return true.
            //Else return false.

            if (_cashRegister.FindBill(5) > 0)
            {
                _cashRegister.RemoveBill(5);
                _cashRegister.AddBill(10);

                return(true);
            }

            return(false);
        }