Example #1
0
 public ChangeStock(int oneThousands, int fiveHundreds, int oneHundreds, int fifties, int tens)
 {
     this.OneThousandStock = new ChangeGroup(Money.OneThousand, oneThousands);
     this.FiveHundredStock = new ChangeGroup(Money.FiveHundred, fiveHundreds);
     this.OneHundredStock = new ChangeGroup(Money.OneHundred, oneHundreds);
     this.FiftyStock = new ChangeGroup(Money.Fifty, fifties);
     this.TenStock = new ChangeGroup(Money.Ten, tens);
 }
Example #2
0
 public ChangeStock(int oneThousands, int fiveHundreds, int oneHundreds, int fifties, int tens)
 {
     this.OneThousandStock = new ChangeGroup(Money.OneThousand, oneThousands);
     this.FiveHundredStock = new ChangeGroup(Money.FiveHundred, fiveHundreds);
     this.OneHundredStock  = new ChangeGroup(Money.OneHundred, oneHundreds);
     this.FiftyStock       = new ChangeGroup(Money.Fifty, fifties);
     this.TenStock         = new ChangeGroup(Money.Ten, tens);
 }
Example #3
0
        private bool ReduceMoneyAndAddChange(ChangeGroup changes, List <Money> change, ref int total)
        {
            var maybeMoney = changes.DrawMoney();

            if (maybeMoney.IsSome)
            {
                var money = maybeMoney.Value;
                change.Add(money);
                total -= money.Value;
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #4
0
 private bool ReduceMoneyAndAddChange(ChangeGroup changes, List<Money> change, ref int total)
 {
     var maybeMoney = changes.DrawMoney();
     if (maybeMoney.IsSome)
     {
         var money = maybeMoney.Value;
         change.Add(money);
         total -= money.Value;
         return false;
     }
     else
     {
         return true;
     }
 }