Question: java eclipse mapping problem Implement shoppingTotal * * Given two maps: * one containing the name of various items mapped to their cost and another
java eclipse mapping problem
Implement shoppingTotal * * Given two maps: * one containing the name of various items mapped to their cost and another * one containing a list of items mapped to their quantity * calculate the total cost of the whole order. * * return an int with the total cost. * * Example 1: * itemToCostMap: { Milk=3, Eggs=5, LaundryDetergent=15, GarbageCan=50} * itemToQuantityMap: {Milk=2, Eggs=1 } * return 11 Note: (2*3 +1*5) * * Example 2: * itemToCostMap: { Milk=3, Eggs=5, LaundryDetergent=15, GarbageCan=50} * itemToQuantityMap: {LaundryDetergent=3, GarbageCan=1 } * return 95 Note: (3*15 +1*50) * * Example 3: * itemToCostMap: { Milk=3, Eggs=5, LaundryDetergent=15, GarbageCan=50} * itemToQuantityMap: {} * return 0 * * * @param itemToCostMap - a HashMap
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
