Home / Expert Answers / Computer Science / please-write-a-new-code-in-java-please-make-sure-it-actually-works-and-follow-the-instructions-well-pa502

(Solved): PLEASE WRITE A NEW CODE IN JAVA, PLEASE MAKE SURE IT ACTUALLY WORKS AND FOLLOW THE INSTRUCTIONS WELL ...



PLEASE WRITE A NEW CODE IN JAVA, PLEASE MAKE SURE IT ACTUALLY WORKS AND FOLLOW THE INSTRUCTIONS WELL. 

Each time we arrive at a station, we must unload our cargo into the station hold for inspection and reload it back into our opublic class MidtermMethods {
public void addItem(Item cargohold []) {
}
}
public void removeItem(Item cargohold []) {
here)

Each time we arrive at a station, we must unload our cargo into the station hold for inspection and reload it back into our own ship's cargo hold when we wish to leave. This is becoming very tedious and taking away time that we could be plundering in space. We head into the station central to research a way to eliminate this problem. We meet a fellow space pirate who has found a solution to the problem we shared. We sit back and listen as he tells us how to find a workaround. • We must now store our items in a file and load from the file if prompted by the user. You can create a file with the list of items so you never have to type them in again, and you can control the items that are introduced to our world. All inputs from the user must be verified for accuracy by catching exceptions for invalid inputs. 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 Equipment, Consumable or Material. (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 up to 10 items, as long as they don't exceed the maximum weight of the cargo bay, 25 Tons. 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 order (Use either a selection or insertion sort) • We need to know how many of each item we have in our cargo bay and display their attributes. The driver you are to use has been attached to the module. Note: You CANNOT modify the MidtermDriver file, you should only modify the file called MidtermMethods.java and you CANNOT change the method headers. You can add other methods as you see fit, but do not modify any of the method headers I have given you. This will break the testing program I have and will result in a lower grade on your assignment. ? public class MidtermMethods { public void addItem(Item cargohold []) { } } public void removeItem(Item cargohold []) { here) - Use // TODO: Add an item that is specified by the user } public void sortItems (Item cargohold[]) { // TODO: Sort the items in the cargo hold (No need to display them duplicates // TODO: Remove an item that is specified by the user } } public void searchItemsByName(Item cargohold []) { // TODO: Search for a user specified item. } public void searchItemsByID(Item cargohold[]) { // TODO: Search for a user specified item } public void loadItems (Item cargohold []) { } public void saveItems (Item cargohold []) { } public void displayItems (Item cargohold []) { // TODO: Display only the unique items along with a count of any // Selection or Insertion sorts // NOTE: Special care is needed when dealing with strings! research the // compareTo() method with strings // For example it should say // Food - 2 // Water 3 // Ammunition - 5


We have an Answer from Expert

View Expert Answer

Expert Answer


************ SOLUTION *************** 1) PRIMARY BASE CODE import java.io.BufferedReader; import java.io.File; import java.io.BufferedWriter; import java.util.*; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.Fi
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe