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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started