Solve a problem in java script

Job ID: 34903611

Budget: $10 – $30 CAD

Pricing Problem

We have a network of vendors who re-sell our products. We wish to provide them an application to calculate the total cost of an order.

The app needs to give volume discounts and include sales tax.

Another system will accept input from the user, and will call this component with 3 inputs:

number of items
price per item
2-letter province/state code

The application should output the total price.

The total price is calculated by:

calculate the total cost for the items
deduct discount based on the quantity
add sales tax based on the province/state code

The following tables give the discount rate and tax rates:
Order Value Discount Rate
$1,000 3%
$5,000 5%
$7,000 7%
$10,000 10%
Province Tax Rate
AB 5%
ON 13%
QC 14.975%
MI 6%
DE 0%
Example 1:

Input: 500 items, $1 per item, Ontario
Output: $565.00

Example 2:

Input: 3600 items, $2.25 per item, Michigan
Output: $7984.98