예제 #1
0
        public List <Sugar> SellSugar(int itemsBeingSold, Bank bank)
        {
            List <Sugar> newSugar = new List <Sugar>();
            Sugar        sugar    = new Sugar();

            if (itemsBeingSold != 20)
            {
                for (int i = 0; i < itemsBeingSold; i++)
                {
                    if (bank.SubtractMoney(sugar.GetCost()))
                    {
                        newSugar.Add(new Sugar());
                    }
                }
            }
            else
            if (bank.SubtractMoney(sugar.GetBulkCost()))
            {
                for (int i = 0; i < itemsBeingSold; i++)
                {
                    newSugar.Add(new Sugar());
                }
            }
            return(newSugar);
        }
예제 #2
0
        public double NumberOfSugarPurchased(int NumberOfSugarNeeded)
        {
            Sugar sugar = new Sugar();

            checkOutSugar = sugar.GetCost() * NumberOfSugarNeeded;
            return(checkOutSugar);
        }