How to convert a number to a range of prices

Posted by Anon1865 on Stack Overflow See other posts from Stack Overflow or by Anon1865
Published on 2010-04-21T15:24:15Z Indexed on 2010/04/21 15:33 UTC
Read the original article Hit count: 202

Filed under:
|

Hi,

I want to calculate the amount to charge my customers, when they buy licenses of my product. I sell it in ranges of licenses:

  • 1-10 : $50/user
  • 11-20 : $40/user
  • 21-30 : $30/user
  • 31-50 : $20/user

So when someone purchases 136 licenses, I will charge him:

100 X $20 = $2000
30 X $30 = $900
6 X $50 = $300

How can I do this in plain C# or LINQ?

Thanks in advanced.

© Stack Overflow or respective owner

Related posts about integers

Related posts about range