Billing coding problem

Oracle - EE 10.2

I have been asked to code an Apex application to replace our current poorly
performing, inaccurate and woefully inadequate billing procedures, most of
which is manual.  Very sad state of affairs for a software company, but
there you have it.  The problem stems from the way we bill certain customers
for archiving their data.  Billing is a tiered structure:

First 10g - flat fee
11-20g    - rate 1
21-50g    - rate 2
Over 50g - rate 3

To further complicate, each rate level bills only for the gig that fall in
that level.  Two examples:

     customer has 15g; they would be billed     flat fee + (5g * rate1).

     customer has 200g; they would be billed     flat fee + (10 * rate1) +
(30 * rate2) + (150 * rate3)

My math skills not being what they should be, I'm having difficulty coming
up with the code to accurately calculate the billing amount.  Any help will
be greatly appreciated.

-- 
Sandy
Transzap, Inc.

Other related posts: