The writer is very fast, professional and responded to the review request fast also. Thank you.
This assignment deals with a program places items into separate inventories.
In this assignment, you will make use of inheritance–e.g., virtual functions. You will need to complete the Armour and Consumable classes.
The program reads data from one file, items-0x.txt. Each line in this file represents one item. The first item on every line denotes the Item type–the remainder of the line varies by item type.
Tool Pickaxe Diamond 100 1 Fortune 5
Potion Speed-II-Potion Spd*2 1
Food Tomato Hunger-10 2
Tool Axe Stone 10 2 Unbreaking 2
Armour Boots Diamond 100 10 Protection 3 lightning
Each Item type is denoted by a keyword:
Tool
indicates a Tool
object.Armour
and Armor
indicate an Armour
object.Food
, Potion
, and Disposable
indicate a Consumable
object.After the leading keywords, each line has a distinct structure:
Tool
line contains–in order–a name, material, durability, speed, enchantment, and enchantment level. Tool
Items are not stackable
.Armour
line contains–in order–a name, material, durability, defense, enchantment, enchantment level, and element. Armour
Items are not stackable
.Consumable
line contains–in order–a name, effect, and # uses. Consumable
Items are stackable
.If the program is run with the first provided input file, items-01.txt, the following output should be generated:
Processing Log:
(S) Speed-II-Potion
(S) Tomato
(S) PotatoCamera
(S) PotatoCamera
(S) Boots
(S) BootsPlayer Storage Summary:
-Used 50% of 10 slots
Nme: Speed-II-Potion
Eft: Spd*2
Use: 1
Qty: 1
Nme: Tomato
Eft: Hunger-10
Use: 2
Qty: 1
Nme: PotatoCamera
Eft: ImageQuality-97%
Use: 5
Qty: 2
Nme: Boots
Dur: 100
Def: 10
Mtl: Diamond
Mdr: Protection (Lvl 3)
Emt: lightning
Nme: Boots
Dur: 100
Def: 10
Mtl: Diamond
Mdr: FeatherFalling (Lvl 4)
Emt: lightning
Note how there is no Tool output. The Tool class is not present in this assignment. The Tool class will be part of a future assignment.
Your output–including labels and spacing–must match the expected output. The easiest way to see generate the expected output is to run the sample executable solution I have provided.
Hint – each line of output in your display functions should probably start with two leading spaces.
To run this program with items-01.txt as input type:
./storage items-01.txt
(On a Windows system, you would omit the “./”. If you are running from Code::Blocks or a similar development environment, you may need to review how to supply command-line parameters to a running program.)
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.
Armour
and Consumable
Default Constructors:
stackable
.Item::name
. The attribute, name
, is a protected data member of Item
.Armour::clone
and Consumable::clone
.Armour::read
and Consumable::read
.Armour::display
and Consumable::display
.You are expected to generate additional input files to test your code. Test your code throughly before submitting your solution.
If you run make
without adding the missing read
, clone
, and display
methods, you will see something simliar to
/usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
Armour.cpp:14: error: undefined reference to 'vtable for Armour'
/usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
Consumable.cpp:4: error: undefined reference to 'vtable for Consumable'
/usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
Consumable.cpp:12: error: undefined reference to 'vtable for Consumable'
/usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
collect2: error: ld returned 1 exit status
make: *** [storage] Error 1
While these errors may be intimidating, they are simply telling you to implement the necessary virtual functions for Armour
and Consumable
.
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
In the grade report that you receive, you will see tests numbered 000 through 008.
Armour::Armour()
Armour::clone()
Armour::display
Armour::read
Consumable::Consumable()
Consumable::clone()
Consumable::display
Consumable::read
Do not procrastinate.
See Attachment
Files to Submit:
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more