Question: This Is Using Java this is the java problem This is the Driver This is the txt file 1 TXT file 2 TXT file 3
This Is Using Java this is the java problem



This is the Driver

This is the txt file 1

TXT file 2

TXT file 3

You will model an adventurer delving deep into dungeon ruins to retrieve treasure. Upon entering the treasure after an arduous journey our adventurer is faced with a large pile of loot. You will have to design a back tracking recursive algorithm to find the optimal items to bring home given how much you adventurer can carry and fit in their backpack. Each item will have an associated weight, size and value. The adventurer will have a maximum weight they can carry and a maximum size for their backpack. Item. java Fields (private): name - a string representing the items name weight - an int for the weight of an item value - an int for the value of an item size- and int for the size of an item Constructor: Initializes all fields Methods: Getters for every field, no setters we will be making items immutable tostring - check sample output for format Backpack.java Fields (private): items - an arraylist of item objects that the backpack is "holding" totalWeight - an int, the current total weight of all items in the backpack totalValue - an int, the current total value of all items in the backpack totalSize - an int, the current total size of all items in the backpack maxSize - an int, the maximum size of items in the backpack Constructor: Initializes all fields. Total values should be set to 0, items should be initialized to an empty list and the max size should be set to the maximum size Methods: Getters for every field addItem- insert an item into the item list removeItem- remove an item from the item list checkSpace - checks if an items size will be equal to or less than the maximum size tostring - check sample output for format
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
