diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..d300203 Binary files /dev/null and b/.DS_Store differ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7881938 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,2 @@ +language: c++ +compiler: make diff --git a/Inventory.cpp b/Inventory.cpp index 57964b4..a918693 100644 --- a/Inventory.cpp +++ b/Inventory.cpp @@ -14,7 +14,15 @@ Inventory::Inventory(string name, float price, int count) void Inventory::sell() { - m_in_stock--; + if(m_in_stock > 0) + { + m_in_stock--; + } + else + { + std::cout << "Sorry, that item is out of stock" << std::endl; + } + } ostream& operator<<(ostream& stream, const Inventory& item) diff --git a/Inventory.h b/Inventory.h index c52d5d8..67a51ea 100644 --- a/Inventory.h +++ b/Inventory.h @@ -5,6 +5,18 @@ using std::string; using std::ostream; +/* +Summary of class Inventory: +Keeps track of an inventory item by name, including price and stock. + +String m_name: Name of the inventory item +Float m_price: Price of the inventory item +Int m_in_stock: Quantity of the inventory item + +Void sell() subtracts one from the stock quantity +The item price can be be printed from outside of this class using <