Question: Shopping cart Billing -------------- THE LANGUAGE ISC# C# An e-commerce company is currently celebrating ten years inbusiness They are having a sale to honor their

Shopping cart Billing -------------- THE LANGUAGE ISC# C#

An e-commerce company is currently celebrating ten years inbusiness They are having a sale to honor their privileged members.those who have been using their services for past five years. They receive the best Discount indicated by any discount tagattached to the products.Determine the minimum cost to purchase allproducts listed .As each potential price is calculated , round itto the nearest integer before adding it to the total .return thecost to purchase all items as an integer .

There are 3three types of discount

- type 0: discount price , the item is sold for a givenprice

- type 1 : percentage discount , the customer is given afixed percentage discount from the retail price

- type 2 : fixed discount : the customer is given a fixedamount off the retail price.

Example :product = [['10', 'do', 'd1'] , ['15', 'EMPTY',EMPTY'], ['20', 'd1','EMPTY']] discounts = [['do', '1', '27'], ['d1, '2','5',]]

The product array element are in the form ['price', 'tag1','tag2'.....tagm-1.] There maybe zero or more discount codesassociated with the product.Discount tags in product array maybe 'EMPTY' which is the same as NULL value.The Discount Arrayelements are in form['tag', 'type', 'amount']

1 If a privileged member buys product 1 listed at a price of 10with two discount available:

Underdiscount d0 of type 1 , the discounted price is 10- 10*0.27 = 7.30,round 7. Under discount of d1 of type 2,the discounted price price is 10-5 = 5

The priceto purchase the product 1 is the lowest of the two, or 5 in thiscase.

2. The second product is priced at 15 because there are nodiscounts available

3The third product is priced at 20 .Using discount tag d1 oftype 2, the discount price is 20-5 = 15

thetotal price to purchase the three item is 5+15+15 = 35.

NOTES: Not all items will have the Maximum number of tags. Emptytags may just not exist in input or they maybe filled with thestring Empty.These are equivalent as demonstrated in the exampleabove

FUNCTION DESCRIPTION

Complete the function. Find LowestPrice in the editor below.

[string] products[n][m]: a 2D array of product descriptors asstrings:price followed up by up to m-1 discount tags. [string] discounts[3] : a 2D array of tagdescriptors as string: tag, type amount. int: the totalamount paid in for all listed products , discounts to privilegedmembers pricing.

Constraints 1

SAMPLE CASE 0

STIN

----

-

------------

-----

2 >

= 2

3

products [i]size

m= 3

Step by Step Solution

3.50 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem we need to determine the lowest possible cost for each product considering all applicable discounts We will then calculate the total cost of all products after applying the relev... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!