Method | Description | |
---|---|---|
Add ( |
Adds the given product to this inventory if it has a quantity greater than 0.
|
|
Contains ( string product ) : bool |
Checks if this inventory contains a product by the given name.
|
|
Get ( string product, int quantity ) : |
Gets the given product from this inventory. The amount returned is equal to the specified quantity or the amount stocked by this inventory; which ever is less. The inventory has an equal amount of product removed.
|
|
Inventory ( ) : System |
A new, empty inventory.
|
|
Price ( string product ) : float |
Checks the price per unit for a product by the given name. The Raises an exception if this inventory does not contain the given product.
|
|
Quantity ( string product ) : int |
Checks the quantity of a product by the given name.
|
Method | Description | |
---|---|---|
CalculateTotal ( ) : void |
Calculates the total cost of all items in this inventory. TotalCost is equal to the sum of (quantity * price) for all products.
|
public Add ( |
||
product | The product to store in this inventory. | |
return | void |
public Contains ( string product ) : bool | ||
product | string | The name of the product to check for. |
return | bool |
public Get ( string product, int quantity ) : |
||
product | string | The name of the product to obtain |
quantity | int | The desired amount of product |
return |
public Price ( string product ) : float | ||
product | string | The name of the product to get a price per unit for |
return | float |
public Quantity ( string product ) : int | ||
product | string | The name of the product to check the quantity of. |
return | int |