【发布时间】:2012-08-02 14:57:17
【问题描述】:
折扣计算:
Product quantity and range
1 - 10 - 1%
11 - 20 - 2%
21 - 30 - 3%
31 - 40 - 4%
41 - 50 - 5%
以上是数量范围和他们给出的折扣%,
for example:
each product cost is 100
if i purchase 50 product then 5% discount is 250
Now if i purchase 50 products at 2 terms let say 20 and 30 then
for 20 product 2% discount = 40
for 30 product 3% discount = 90
total discount = 130
但是在这里我必须得到 250 的折扣,
问题描述: 该产品可以购买n个条款的最大数量,这里最大数量为50。购买产品的折扣%是从上述范围内给出的。当添加总折扣时,它应该是相等的。在这里,当购买 50 件产品时,250 作为折扣给予相同的 250 应该是总折扣,即使产品以 20、10、10 或 25、25 的形式购买......
请帮我计算部分,用一些公式或任何东西....
【问题讨论】:
-
@tom10 伙计们,这不是家庭作业...我不是数学专家...我是一名程序员,我正在尝试在我的程序中实现它...我需要计算部分请帮助我
-
@and 我尝试了一些简单的计算,但它不起作用,我得到的总折扣要么低要么高......当我使用等于范围差异的数量术语时,我得到它,但是当数量在它变化的范围内......我不知道该怎么做......请帮助
标签: math range discount cumulative-sum