The first parameter is a HashMap<String, Double>
representing the selling price of each item in our store . The second parameter is a HashMap<String, Integer>
representing our inventory at the start of the day (quantities of each item in the store). The third parameter is an ArrayList<HashMap<String, Integer>>
representing all the orders that have been made in a day. This is an ArrayList
where each element is a HashMap<String, Integer>
representing a customer's cart.This method should compute and return the total cost to purchase all of our remaining inventory at the end of the day. That is, how much value we have in inventory after all the customer purchases have been processed.
Can someone help me out with this problem? Thanks!
So far I have this
import java.util.ArrayList;
import java.util.HashMap;
public class thi {
public static double totalCostOfInventory(HashMap<String, Double> sellingPrice, HashMap<String, Integer> inventory, ArrayList<HashMap<String, Integer>> orders) {
double ans = 0;
int i =0, j = 0;
for(i=0;i< orders.size();i++) {
HashMap<String,Integer> temp = orders.get(i);
for (j=0;j < temp.size();j++) {
String key = temp.get(j);
}
}
return ans;
}
}