Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
language: c++
compiler: make
10 changes: 9 additions & 1 deletion Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions Inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<InventoryInstance
*/

class Inventory
{
private:
Expand Down
7 changes: 7 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Project Inventory

Included files:
Makefile
main.cpp
Inventory.h
Inventory.cpp