Supermarket.Inventory.Quantity C# (CSharp) Method

Quantity() public method

Checks the quantity of a product by the given name.
public Quantity ( string product ) : int
product string The name of the product to check the quantity of.
return int
        public int Quantity(string product)
        {
            // If the inventory contains the product: return it's quantity
            if (Contains(product))
            {
                return items[product].Quantity;
            }
            // Otherwise quantity is 0
            else
            {
                return 0;
            }
        }