Shopping Basket Discount

Items in a shopping basket have a unit price and quantity. Write code that will allow you to:

Normally the total price is the sum of unit price * quantity for all the items. If you buy in bulk you get a discount:

Example

This basket qualifies for a 5% discount and the total price is $151.94

Acknowledgements

I got this kata from Jason Gorman but I have changed it slightly.

Referenced in these Learning Hours: