1 Input
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
Tool Shovel Gold 20 3 Unbreaking 2
Tool Pickaxe Diamond 100 1 Fortune 5
Potion Speed-II-Potion Spd*2 1
Food Tomato Hunger-10 2
Disposable PotatoCamera ImageQuality-97% 5
Disposable PotatoCamera ImageQuality-97% 5
Tool Axe Stone 10 2 Unbreaking 2
Armour Boots Diamond 100 10 Protection 3 lightning
Armor Boots Diamond 100 10 FeatherFalling 4 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:
The remainder of a Tool line contains–in –a name, material, durability, speed, modifier, and modifier level. Tool Items are not stackable.
The remainder of a Armour line contains–in –a name, material, durability, defense, modifier, modifier level, and element. Armour Items are not stackable.
The remainder of a Consumable line contains–in –a name, effect, and # uses. Consumable Items are stackable.
In each of the above classes, you will need to:
Set the stackable attribute–i.e., super.stackable. The attribute, stackable, is a private data member of Item.
Set the name attribute–i.e., super.name. The attribute, name, is a protected data member of Item.
2 Output
If the program is run with the first provided input file, items-01.txt, the following output should be generated:
Processing Log:
(S) Pickaxe
(S) Shovel
(S) Pickaxe
(S) Speed-II-Potion
(S) Tomato
(S) PotatoCamera
(S) PotatoCamera
(S) Axe
(S) Boots
(S) Boots
Player Storage Summary:
-Used 90% of 10 slots
Nme: Pickaxe
Dur: 100
Spd: 1
Mtl: Diamond
Mdr: Fortune (Lvl 5)
Nme: Shovel
Dur: 20
Spd: 3
Mtl: Gold
Mdr: Unbreaking (Lvl 2)
Nme: Pickaxe
Dur: 100
Spd: 1
Mtl: Diamond
Mdr: Fortune (Lvl 5)
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: Axe
Dur: 10
Spd: 2
Mtl: Stone
Mdr: Unbreaking (Lvl 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
Your output–including labels and spacing–must match the expected output.
3 Your Tasks
The key abstractions employed in this program are Inventory, Item, ItemStack, Tool, Armour, and Consumable.
Do not change the packages. The package must remain package edu.odu.cs.cs330.items; for Tool, Armour, and Consumable. Changing the package is an automatic fail. Is this strict? Absolutely. However, I am explicitly instructing you to use this package.
You have a few tasks to complete. First, start with the Armour and Consumable ADTs:
Complete the Default Constructor for each class.
Complete the Copy Constructor for each class.
Complete the clone method for each class.
Complete the read method in each class.
Complete the toString method in each class.
The first few tasks should be familiar–they were your tasks in Assignment 4!. You will then need to complete:
Armour.equals
Armour.hashCode
Consumable.equals
Consumable.hashCode
The rules for computing hash codes and checking for equivalence are listed the Javadoc comments (i.e., in comments before the function).
Adding the Tool Class
Your final set of tasks involve completing the Tool class.
Complete the Tool Constructor.
Complete the Tool Copy Constructor.
Complete the Tool clone method.
Complete the Tool read method.
Complete the Tool toString method.
Complete the Tool equals method.
Complete the Tool hashCode method.
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