or a nearby debris field to hide in. We notice one not too far away, but we need to make sure that we can get to the middle o

icon
Related questions
Question

Java problem.

While out on a standard run we notice that our radar is picking up someone following us. In the hopes of losing them, we look for a nearby debris field to hide in. We notice one not too far away, but we need to make sure that we can get to the middle of the debris field to be properly hidden. Our radar shows the debris field in 2D, so we can visually check if we can make it to the center, but that takes too long. We want a program that will let us know if there is a path from the outside of the debris field to the center. In order to solve this problem, we must think recursively. 

  • Create a recursive algorithm that determines if a path exists from the outside of the debris field to the center. The debris field is always square (n by n) and n will always be greater than 1, and always odd. You can enter the debris field from any of the outside spaces, and you simply need to return true if a path exists, and false if a path does not exist. For movement you can only go up, down, left or right. You cannot move diagonally. I have included a small file for you to write your code in before you merge it with the remainder of your assignment (In the additional files section of this module). Your method name MUST use the following header: 
    • public void findCenter(int row, int column) { }
  • The item class must now implement the Comparable interface and override the compareTo() method. In the item class, you MUST use the value as your item to compare by.
  • You must now implement a second sort method that sorts based on your compareTo() methods. This can be done using Arrays.sort() or Collections.sort().
  • We must save and load to a file, at some point, throughout our program.
  • 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 the name and another on any attribute you choose).
  • We need to be able to sort items by their names alphabetically in order
  • We need to know how many of each item we have in our cargo bay and display their attributes.
  •  

Note: With your submission of this assignment you must include all of your files AND your file that you created to load into your program.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer