Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I need to create a generic java program that does the following. Assume this program will use an ArrayList for the stored items. Create

Hi I need to create a generic java program that does the following. Assume this program will use an ArrayList for the stored items. Create an algorithm that maximizes the amount of money we will get if we ever come across this situation again. We will call this method ransack and it should accept a large list of items and return the optimal list of items we should grab based on our weight limit. We must store our items in a file and read 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. 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 dont exceed the maximum weight of the cargo bay, 25 Tons. (Use an ArrayList that checks an items weight before placing it in the file

The input file is as follows, but it can any generic file

import java.util.*;

public class Item {

private String Name;

private Double Weight;

private String Value;

private String Durability;

private String ID;

public Item(){

}

public String getName(){

return Name;

}

public void setName (String Name) {

this.Name = Name;

}

public Double getWeight(){

return Weight;

}

public void setWeight(Double Weight) {

this.Weight = Weight;

}

public String getValue(){

return Value;

}

public void setValue(String Value) {

this.Value = Value;

}

public String getDurability(){

return Durability;

}

public void setDurability (String Durability) {

this.Durability = Durability;

}

public String getID(){

return ID;

}

public void setID (String ID) {

this.ID= ID;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. How would this philosophy fit in your organization?

Answered: 1 week ago

Question

3. What information do participants need?

Answered: 1 week ago