Back to problems

Code Craft: Cart with Promotions

Object-Oriented Programming · DoorDash · Medium

Requirements Design an object-oriented shopping cart pricing system. Input: items: a list of (name, price) pairs. shipping: a flat shipping charge added to the item subtotal. promotions: a collection of promotion objects. Support these two promotion kinds: PercentDiscount(percent): reduces the item subtotal by the given percentage. Shipping is excluded from this calculation. FixedDiscount(amount): subtracts the specified amount from the combined item subtotal and shipping…

Checking your access…