← 返回 oracle 的题目列表Shopping List Price Calculation
类型:online_judge
Given two arrays: one containing items and their prices, and another containing item discounts. Additionally, a shopping list with potential duplicate items is provided. Write a program to calculate the discounted total price for each item in the shopping list and output in the format <item, price, discounted_total_price>. Note: the program should inherit from an abstract class, and the constructor needs to be implemented by you.
Example
Input
items = [('apple', 100), ('banana', 150), ('cookie', 200)]
discounts = [('apple', 0.1), ('cookie', 0.2)]
shopping_list = ['apple', 'banana', 'apple', 'cookie']
Output
[('apple', 100, 90.0), ('banana', 150, 150.0), ('apple', 100, 90.0), ('cookie', 200, 160.0)]