Application

Report a typo

In the store, all products are stored in a Map<String, Int>, which holds name - price pairs.
The customer comes with a shopping list and wants to know what the total price of products on the list will be. Keep in mind that some products may not be available in the store.

You are given Map<String, Int> (product name and price) and MutableList of String (shopping list) as the function parameters. Return the total price of the items the customer needs to buy.

Sample Input 1:

{Cola to 500}, {Apple to 1500}, {Banana to 300}
Cola Apple

Sample Output 1:

2000

Sample Input 2:

{Pen to 1}, {Ananas to 2}, {Sheet to 0}
Result is One or Zero

Sample Output 2:

0

Sample Input 3:

{Sprite to 150}, {Lays to 200}, {Milk to 600}, {Snickers to 100}
Sprite Lays Coffee

Sample Output 3:

350
Write a program in Kotlin
fun bill(priceList: Map<String, Int>, shoppingList: MutableList<String>): Int {
// put your code here
}
___

Create a free account to access the full topic