Hello I need a help with creating this program: On our way to the nearest space
ID: 3596912 • Letter: H
Question
Hello I need a help with creating this program:
On our way to the nearest space station we think of a way to classify the items in our cargo bay.
We decide that it would be best to classify the items in our hold as equipables, consumable, weapons,
and armor. When we arrive at the station, we create a clear hierarchy for all of our items. After fencing
our loot, we decide to rest at this station for the night.
Items have attributes such as Name, Weight, Value, Durability and ID. (Create an object called
‘Item’)
We now classify our items by separating them into 3 distinct categories Equipable, Consumable
or Weapon. (You must implement these 3 classes that are subclasses of Item and they must
have at least 3 unique attributes in each subclass)
We can carry an unlimited number of items, as long as they don’t exceed the maximum weight
of the cargo bay, 25 Tons. (Use an ArrayList that checks an item’s weight before placing it in the
cargo hold)
We need to be able to add and remove items by their name.
We need to be able to search for a specific type of item in our cargo bay based on the item’s
name and one of its attributes (Implement 2 searches – one on name and another on any
attribute you choose).
We need to be able to sort items by their names alphabetically in descending order (A-Z)
We need to know how many of each item we have in our cargo bay and display their attributes.
Thak you in advance!
Explanation / Answer
Please find Item.java class
See Equipable.java class
See Consumable.java class
See Weapon.java class
Cargo.java class to hold all types of Item
Test class to test all code TestCargo.java:
Please revert if you need any help on these classes.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.