示例#1
0
        private ReturnedBills CalculateAmounts(long requestedAmount)
        {
            int baseFifties  = 0;
            int baseHundreds = 0;
            int baseTwenties = 0;

            ReturnedBills result = null;

            baseHundreds = (int)requestedAmount / 100;

            var remainingAmount = requestedAmount - baseHundreds * 100;

            if (remainingAmount != 0)
            {
                baseFifties = (int)remainingAmount / 50;

                remainingAmount = remainingAmount - baseFifties * 50;

                if (remainingAmount != 0)
                {
                    baseTwenties = (int)remainingAmount / 20;
                }
            }

            result = new ReturnedBills
            {
                Hundreds = baseHundreds,
                Fifties  = baseFifties,
                Twenties = baseTwenties
            };

            return(result);
        }
示例#2
0
        public ReturnedBills CalculateBills(long requestedAmount)
        {
            ReturnedBills result = null;

            result = CalculateAmounts(requestedAmount);

            return(result);
        }