From 642d995509885adc693040886dd2bd8d4cb4a20d Mon Sep 17 00:00:00 2001 From: Svyatoslav Chukhlebov Date: Wed, 12 Feb 2020 11:21:30 -0800 Subject: [PATCH 1/4] Fixed issues "Project is completely undocumented" and "Negative Inventory Bug" --- .DS_Store | Bin 0 -> 6148 bytes Inventory.cpp | 10 +++++++++- Inventory.h | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..fd01b40b0eadaafc873401bec12cde88d033b8f2 GIT binary patch literal 6148 zcmeHKJxc>Y5PcI9hy)>>mRDK{);33oMG7nbfF?#1PcKL!*j?j~@%Q-y^v%u?av!!L zIs-dzcXrbcDz>r0;w@=q$+OMT$J&z2ClEzriigGb8%6Tg{0>4uM z-MayOj zSVKH=ZTFn5a~3&lLV-}=A1c5zTWvTp3?B-F0-?ZG z0sTH?EQ+~fWtcu4bm@%EhH#<4k1Fs5&~Z@^ literal 0 HcmV?d00001 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 < Date: Wed, 12 Feb 2020 11:39:17 -0800 Subject: [PATCH 2/4] Added TravisCI yml file, readme.txt, solved two issues: corrected Negative Inventory Bug and added documentation to Inventory.h --- .DS_Store | Bin 6148 -> 6148 bytes .travis.yml | 1 + readme.txt | 7 +++++++ 3 files changed, 8 insertions(+) create mode 100644 .travis.yml create mode 100644 readme.txt diff --git a/.DS_Store b/.DS_Store index fd01b40b0eadaafc873401bec12cde88d033b8f2..d3002031e9c056863155c714aceca5f3573de857 100644 GIT binary patch delta 82 zcmZoMXfc=|#>B`mu~2NHo}wrV0|Nsi1A_nqLmop3Lq0B)qu~2NHo}w@-0|Nsi1A_nqLy2cjesWSye$wWLj4K(nK@zMCi41xS z`3$89NuVfDE#qe(t??fW7#KG5FkWQc%+A5j0W=q=`#bYwei2I!ps_#%lnxNt!VCZb CbskUv diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b478801 --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: c++ diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..9fd12b4 --- /dev/null +++ b/readme.txt @@ -0,0 +1,7 @@ +Project Inventory + +Included files: +Makefile +main.cpp +Inventory.h +Inventory.cpp From d4a289430fa7ee1984190652c45e29e7ed2a54ac Mon Sep 17 00:00:00 2001 From: Svyatoslav Chukhlebov Date: Wed, 12 Feb 2020 11:43:35 -0800 Subject: [PATCH 3/4] Specified g++ as compiler for TravisCI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b478801..ceb2f47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1 +1,2 @@ language: c++ +compiler: g++ From 1f1a7c35b6072d18561a3e517d3349b562082b5f Mon Sep 17 00:00:00 2001 From: Svyatoslav Chukhlebov Date: Wed, 12 Feb 2020 11:52:12 -0800 Subject: [PATCH 4/4] Modified compiler to 'make' --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ceb2f47..7881938 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,2 +1,2 @@ language: c++ -compiler: g++ +compiler: make