Answered step by step
Verified Expert Solution
Question
1 Approved Answer
An e - commerce company is currently celebrating ten years in business. They are having a sale to honor their privileged members, those who have
An ecommerce company is currently celebrating ten years in business. They are having a sale to honor their privileged members, those who have been using their services for the past five years.
They receive the best discounts indicated by any discount tags attached to the product. Determine the minimum cost to purchase all products listed.
As each potential price is calculated, round it to the nearest integer before adding it to the total. Return the cost to purchase all items as an integer.
There are three types of discount tags:
Type : discounted price, the item is sold for a given price.
Type : percentage discount, the customer is given a fixed percentage discount from the retail price.
Type : fixed discount, the customer is given Example
products I; do; d; 'EMPTY, 'EMPTY
d; 'EMPTY
discounts d; ; d; ;
The products array elements are in the form price 'tag ; 'tag tag m There may be zero or more discount codes associated with a product. Discount tags in the products array may be 'EMPTY which is the same as a null value. The discounts array elements are in the form tag;
'type', 'amount'a fixed amount off from the retail price.STDIN
Function
products
size n
products
size m
sale januarysale
products
'sale', 'januarysale'
'sale', 'EMPTY'
sale EMPTY
discounts
size d
discountsj
size always
sale
discounts
lsalejanuarysale',
januarysale
Sample Output
in python
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