Esempio n. 1
0
        public double AddItem(Merchandise newItem)
        {
            if (Items.Any(item => item.Equals(newItem)))
            {
                Quantity[newItem.Type + ":" + newItem.Name]++;
            }
            else
            {
                Items.Add(newItem);
                Quantity[newItem.Type + ":" + newItem.Name] = 1;
            }
            Total = 0;
            foreach (Merchandise i in Items)
            {
                int quantity = Quantity[i.Type + ":" + i.Name];
                Total += i.Price * quantity;
            }
            List <double> discounts = BulkBuy();

            Total = Total - discounts[0] - discounts[1];
            return(Total);
        }