Special DiscountAn e –commerce company is planning to give a special discount on all its product to its customers for the Christmas holiday. The company possesses data on its stock of N product types. The data for each product type represents the count of customers who have ordered the given product. If the data K is positive then it shows that the product has been ordered by K customers and is in stock. If the data K is negative then it shows that it has been ordered by K customers but is not in stock. The company will fulfill the order directly if the ordered product is in stock. If it is not in stock, then the company will fulfill the order after they replenish the stock from the warehouse. They are planning to offer a discount amount A for each product. The discount value will be distributed to the customers who have purchased that selected product. The discount will be distributed only if the decided amount A con be divided by the number of orders for a particular product. Write an algorithm for the sales team to find the number of products out of N for which the discount will be distributed
Question
Special DiscountAn e –commerce company is planning to give a special discount on all its product to its customers for the Christmas holiday. The company possesses data on its stock of N product types. The data for each product type represents the count of customers who have ordered the given product. If the data K is positive then it shows that the product has been ordered by K customers and is in stock. If the data K is negative then it shows that it has been ordered by K customers but is not in stock. The company will fulfill the order directly if the ordered product is in stock. If it is not in stock, then the company will fulfill the order after they replenish the stock from the warehouse. They are planning to offer a discount amount A for each product. The discount value will be distributed to the customers who have purchased that selected product. The discount will be distributed only if the decided amount A con be divided by the number of orders for a particular product. Write an algorithm for the sales team to find the number of products out of N for which the discount will be distributed
Solution
The problem can be solved by following these steps:
-
Initialize a variable, say
count, to 0. This will keep track of the number of products for which the discount will be distributed. -
Iterate over the data for each product type. For each product type, do the following:
a. If the data
Kis positive, it means the product has been ordered byKcustomers and is in stock. Check if the discount amountAcan be divided evenly byK(i.e.,AmoduloKis 0). If it can, incrementcountby 1.b. If the data
Kis negative, it means the product has been ordered byKcustomers but is not in stock. In this case, the company will fulfill the order after they replenish the stock from the warehouse. Again, check if the discount amountAcan be divided evenly by the absolute value ofK(i.e.,Amoduloabs(K)is 0). If it can, incrementcountby 1. -
After iterating over all product types,
countwill hold the number of products for which the discount will be distributed. Returncount.
This algorithm works because it checks for each product type whether the discount amount can be divided evenly among the customers who have ordered that product. If it can, the discount will be distributed for that product; otherwise, it won't. By counting the number of product types for which the discount can be distributed, we can find the total number of products for which the discount will be distributed.
Similar Questions
A grocery store chain purchases customer data from a credit card company. The grocer uses this data to identify its most loyal customers and offer them special promotions and discounts. What type of data is being used in this scenario?1 分Multi-party Second-party First-party Third-party
A company allows its sales representatives discretion to offer price discounts below its $4 list price per unit sold. Details relating to three key customers for the month are listed below:Customers A B CUnits sold 10,000 15,000 1,500Discount given per unit $0.30 $0.10 $0.40Number of purchase orders 25 30 27Number of deliveries 52 20 26Number of sales visits 2 1 1Miles travelled per delivery 12 35 30Number of 'fast' orders 1 4 1 Additional information: A 'fast' order is an emergency order, outside of normal delivery schedules, and incurs a total cost of $150. Other cost-driver rates are detailed as follows:Activity Area Cost-Driver RateOrder-taking $80 per orderDelivery vehicle costs $1 per mile travelledSales visits $90 per visitProduct packaging $0.05 per unit sold Assuming the cost of goods sold is $3 per unit, calculate the operating profit generated by customer C.
A company allows its sales representatives discretion to offer price discounts below its $4 list price per unit sold. Details relating to three key customers for the month are listed below: Customers A B CUnits sold 10,000 15,000 1,500Discount given per unit $0.30 $0.10 $0.40Number of purchase orders 25 30 27Number of deliveries 52 20 26Number of sales visits 2 1 1Miles travelled per delivery 12 35 30Number of 'fast' orders 1 4 1 Additional information: A 'fast' order is an emergency order, outside of normal delivery schedules, and incurs a total cost of $150. Other cost-driver rates are detailed as follows: Activity Area Cost-Driver RateOrder-taking $80 per orderDelivery vehicle costs $1 per mile travelledSales visits $90 per visitProduct packaging $0.05 per unit sold Assuming the cost of goods sold is $3 per unit, calculate the operating profit generated by customer B.
Which statement would you use to query the database for the quantity and description of each item thatwas ordered before June 1, 1999, and whose price is less than 0.25 or greater than 10.00?
Use the Customer TableThis query will need to join the Customer table to the Orders Table by CustomerIDThis query will need to join the Orders table to the OrderItems Table by OrderIDDisplay this content:Display the Email address,Sum of ItemPrice * Quantity as 'ItemPriceTotal'Calculate the DiscountAmount * Quantity as "Discount Amount Total"Group this output by EmailAddressSort the data using the ItemPriceTotal in descending order.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.