Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The PredatoryCreditCard class of Section 2.4.1 provides a process month method t

ID: 3879280 • Letter: T

Question

The PredatoryCreditCard class of Section 2.4.1 provides a process month method that models the completion of a monthly cycle. Modify the class so that once a customer has made ten calls to charge in the current month, each additional call to that function results in an additional $1 surcharge. by python

this is of section 2.4.1

1 class PredatoryCreditCard(CreditCard):

2 ”””An extension to CreditCard that compounds interest and fees.”””

3

4 def init (self, customer, bank, acnt, limit, apr):

5 ”””Create a new predatory credit card instance.

6

7 The initial balance is zero.

8

9 customer the name of the customer (e.g., John Bowman )

10 bank the name of the bank (e.g., California Savings )

11 acnt the acount identifier (e.g., 5391 0375 9387 5309 )

12 limit credit limit (measured in dollars)

13 apr annual percentage rate (e.g., 0.0825 for 8.25% APR)

14 ”””

15 super( ). init (customer, bank, acnt, limit) # call super constructor

16 self. apr = apr

17

18 def charge(self, price):

19 ”””Charge given price to the card, assuming sufficient credit limit.

20

21 Return True if charge was processed.

22 Return False and assess 5 fee if charge is denied.

23 ”””

24 success = super( ).charge(price) # call inherited method

25 if not success:

26 self. balance += 5 # assess penalty

27 return success # caller expects return value

28

29 def process month(self):

30 ”””Assess monthly interest on outstanding balance.”””

31 if self. balance > 0:

32 # if positive balance, convert APR to monthly multiplicative factor

33 monthly factor = pow(1 + self. apr, 1/12)

34 self. balance = monthly factor

Explanation / Answer

from .credit_card import CreditCard

class PredatoryCreditCard(CreditCard):
"""An extension to CreditCard that compounds interest and fees."""
  
def __init__(self, customer, bank, acnt, limit, apr):
"""Create a new predatory credit card instance.
The initial balance is zero.
customer the name of the customer (e.g., 'John Bowman')
bank the name of the bank (e.g., 'California Savings')
acnt the acount identifier (e.g., '5391 0375 9387 5309')
limit credit limit (measured in dollars)
apr annual percentage rate (e.g., 0.0825 for 8.25% APR)
"""
super().__init__(customer, bank, acnt, limit) # call super constructor
self._apr = apr

def charge(self, price):
"""Charge given price to the card, assuming sufficient credit limit.
Return True if charge was processed.
Return False and assess $5 fee if charge is denied.
"""
success = super().charge(price) # call inherited method
if not success:
self._balance += 5 # assess penalty
return success # caller expects return value

def process_month(self):
"""Assess monthly interest on outstanding balance."""
if self._balance > 0:
# if positive balance, convert APR to monthly multiplicative factor
monthly_factor = pow(1 + self._apr, 1/12)
self._balance *= monthly_factor

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote