Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 where the key is the item name and the value is the cost * @param itemToQuantityMap - a HashMap where the key is the item name and the value is the quantity to buy * @return int - total cost of buying everything * * You may assume that all items in the itemToQuantityMap WILL be in the itemToCostMap * If there are no entries in the itemToQuantityMap, you should return 0. */ public static int calculateShoppingTotal(HashMap itemToCostMap, HashMap itemToQuantityMap) {

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3. List your top 10 film mentors.

Answered: 1 week ago

Question

Define promotion.

Answered: 1 week ago

Question

Write a note on transfer policy.

Answered: 1 week ago

Question

Discuss about training and development in India?

Answered: 1 week ago

Question

Explain the various techniques of training and development.

Answered: 1 week ago

Question

2. Identify conflict triggers in yourself and others

Answered: 1 week ago