← 返回 stripe 的题目列表Calculate Order Total Cost with Static Shipping Rates
类型:online_judge
Given an order object and a static shipping rate table for each country, calculate the total cost by summing up the price multiplied by the quantity of each product, and adding the shipping cost.
Input:
An order object that includes the name, price, and quantity of products.
A static shipping rate table, which gives a shipping cost for each country.
Output: The total cost combining products and shipping cost.
Example:
Input: Order = [{"name": "mouse", "price": 550, "quantity": 10}, {"name": "laptop", "price": 1000, "quantity": 15}], Shipping Rates = {"US": 200}
Output: 16100
Example
Input
{"order": [{"name": "keyboard", "price": 600, "quantity": 10}, {"name": "monitor", "price": 800, "quantity": 10}], "shipping_rates": {"US": 100}}