Chat with us, powered by LiveChat 1 Input The program reads data from one file, items-0x.txt. Each line in this file represents one | WriteDen

1 Input The program reads data from one file, items-0x.txt. Each line in this file represents one

 

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:

  1. The remainder of a Tool line contains–in order–a name, material, durability, speed, modifier, and modifier level. Tool Items are not stackable.
  2. The remainder of a Armour line contains–in order–a name, material, durability, defense, modifier, modifier level, and element. Armour Items are not stackable.
  3. The remainder of a Consumable line contains–in order–a name, effect, and # uses. Consumable Items are stackable.

In each of the above classes, you will need to:

  1. Set the stackable attribute–i.e., super.stackable. The attribute, stackable, is a private data member of Item.
  2. 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:

  1. Complete the Default Constructor for each class.
  2. Complete the Copy Constructor for each class.
  3. Complete the clone method for each class.
  4. Complete the read method in each class.
  5. 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:

  1. Armour.equals
  2. Armour.hashCode
  3. Consumable.equals
  4. 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.

  1. Complete the Tool Constructor.
  2. Complete the Tool Copy Constructor.
  3. Complete the Tool clone method.
  4. Complete the Tool read method.
  5. Complete the Tool toString method.
  6. Complete the Tool equals method.
  7. Complete the Tool hashCode method.

HOW OUR WEBSITE WORKS

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of 
HIGH QUALITY & PLAGIARISM FREE.

Step 1

To make an Order you only need to click ORDER NOW and we will direct you to our Order Page at WriteDen. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
 Deadline range from 6 hours to 30 days.

Step 2

Once done with writing your paper we will upload it to your account on our website and also forward a copy to your email.

Step 3
Upon receiving your paper, review it and if any changes are needed contact us immediately. We offer unlimited revisions at no extra cost.

Is it Safe to use our services?
We never resell papers on this site. Meaning after your purchase you will get an original copy of your assignment and you have all the rights to use the paper.

Discounts

Our price ranges from $8-$14 per page. If you are short of Budget, contact our Live Support for a Discount Code. All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Please note we do not have prewritten answers. We need some time to prepare a perfect essay for you.