예제 #1
0
        public override string ToString()
        {
            String objectString = ".:Lista de Productos: ";

            foreach (ProductSellList product in list)
            {
                objectString += $"\n-> {product.ToString()}";
            }

            objectString += $"\nTotal de venta: ${total}";
            objectString += $"\nProducto mas vendido: {bestSellingProduct.GetProduct().GetName()} ";
            objectString += $"\nPromedio de precios: ${averaguePriceProducts}";
            return(objectString);
        }
예제 #2
0
        // Fill restand properties
        public void SetData()
        {
            for (int i = 0; i < list.Length; i++)
            {
                ProductSellList product = list[i]; // total current product
                total += product.GetTotal();       // add to total list
                averaguePriceProducts += product.GetProduct().GetPrice();
                if (product.GetQuantity() > list[bestSellingProductIndex].GetQuantity())
                {
                    bestSellingProductIndex = i;
                }
            }

            averaguePriceProducts /= quantity;
        }