72. Computing order price with discounts

A retail store sells a variety of goods and can offer various types of discount, for selected customers, articles, or per order. The following types of discount could be available:

  • A fixed discount, such as 5%, regardless of the article or the quantity that is purchased.
  • A volume discount, such as 10%, for each article when buying more than a particular quantity of that article.
  • A price discount per total order of an article, that is, a discount for an article when a customer buys a quantity of that article so that the total cost exceeds a particular amount. For instance, a 15% discount for an article when the total cost of that article exceeds $100. If the article costs $5, and the customer buys ...

Get The Modern C++ Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.