|You are in possesion of a special bag of devouring. You can put anything you like into the bag and it never becomes bulkier or heavier. Whenever you want to retrieve something from the bag, just reach in and pull it out, if it's there. The catch is that every time you take an item out of the bag there is a chance that the bag will devour one of the remaining items. The chances that a particular item is devoured depends on the weight of that item, in pounds, and all the other items still in the bag. To find the probability that an item will be devoured, divide the weight of that item by the total weight of all the items in the bag + 100. The only time an item might be devoured is immediately after removing an item from the bag, and at most one item is devoured at each of these opportunities.|
You've already put quite a few items of value in the bag and want to know the expected value of the items remaining after all of the items have either been removed from the bag or devoured. Create a class BagOfDevouring that has a method expectedYield that takes a int values and a int weights and returns a double that is the expected value of the items removed from the bag. You will always remove the item that maximizes the expected value of items removed.
|-||values and weights will both contain between 0 and 15 elements, inclusive.|
|-||values and weights will both contain the same number of elements.|
|-||Each element of values and weights will be between 1 and 10000, inclusive.|