Tasks
The key abstractions employed in this program are Item
, ItemStack
, Inventory
Armour
, and Consumable
.
Your overall task is to complete the Armour
and Consumable ADTs.
- As an initial step, you will need to complete the
Armour
andConsumable
Default Constructors:
a. Set the stackable attributei.e.,stackable
.
Hint Remember initializer lists? b.Set the name attributei.e.,Item::name
. The attribute,name
, is a protected data member ofItem
. - Implement
Armour::clone
andConsumable::clone
. - Implement
Armour::read
andConsumable::read
. - Implement
Armour::display
andConsumable::display
.
You are expected to generate additional input files to test your code. Test your code throughly before submitting your solution.
Testing Your Code
I have provided you a set of unit tests. In addition to your normal checks (e.g., running the completed program and performing head-to-head testing) run the unit tests with
make tests
./testNewClasses
You should see:
PASSED -> testDefaultArmourConstructor
PASSED -> testArmourCopyConstructor
PASSED -> testArmourClone
PASSED -> testArmourDisplay
PASSED -> testArmourRead
PASSED -> testDefaultConsumableConstructor
PASSED -> testConsumableCopyConstructor
PASSED -> testConsumableClone
PASSED -> testConsumableDisplay
PASSED -> testConsumableRead
n the grade report that you receive, you will see tests numbered 000 through 008.
- Test 000 evaluates your implementation of
Armour::Armour()
- Test 001 evaluates your implementation of
Armour::clone()
- Test 002 evaluates your implementation of
Armour::display
- Test 003 evaluates your implementation of
Armour::read
- Test 004 evaluates your implementation of
Consumable::Consumable()
- Test 005 evaluates your implementation of
Consumable::clone()
- Test 006 evaluates your implementation of
Consumable::display
- Test 007 evaluates your implementation of
Consumable::read
- Test 008 (System Test) evaluates all both classesi.e., your solution as a wholeincluding output and output formatting.
Submitting
Files to Submit:
- Armour.cppi.e., your version of the Armour ADT.
- Consumable.cppi.e., your version of the Consumable ADT.