In our quest to stay in touch with what's going on in the commercial world we've decided to open a supermarket - we sell only three products:
Product code | Name | Price |
---|---|---|
FR1 | Fruit tea | £3.11 |
SR1 | Strawberries | £5.00 |
CF1 | Coffee | £11.23 |
Our CEO is a big fan of buy-one-get-one-free offers and of fruit tea. She wants us to add a rule to do this.
The COO, though, likes low prices and wants people buying strawberries to get a price discount for bulk purchases. If you buy 3 or more strawberries, the price should drop to £4.50 each.
Our checkout can scan items in any order, and because the CEO and COO change their minds often, it needs to be flexible regarding our pricing rules.
- Your goal is to implement a checkout so that it will scan items in and calculate total prices correctly for any combination of the products and offers above.