Find the discount decision hidden inside a fee

An event service sells a ticket with an undiscounted price of 96.00 US dollars. The sales team increases the discount from 25% to 30%. The fee policy remains unchanged: charge 1.20 US dollars plus 5% of the actual discounted ticket price.


A developer updates only DiscountPolicy. The current Python code is shown below. Both methods receive the undiscounted ticket price as price; the receipt display simply shows their returned values. There are no other adjustments or rounding operations.


Python
class DiscountPolicy:
    def discounted_price(self, price):
        return price * 0.70

class FeePolicy:
    def fee(self, price):
        return 1.20 + 0.05 * (price * 0.75)


The undiscounted ticket price feeds two classes whose returned values are sent to a receipt display.


Complete the table using exact decimal dollar amounts without units. For the final row, enter the class name outside DiscountPolicy that also contains a discount decision.

Requested resultAnswer
New discounted ticket price in USD
Fee returned by the current code in USD
Fee required by the unchanged fee policy in USD
Current fee minus required fee in USD
Other class containing a discount decision

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Single Responsibility Questions: