Question

The PredatoryCreditCard class of Section 2.4.1 provides a process month method that models the completion of...

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

0 1
Add a comment Improve this question Transcribed image text
Answer #1

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

Add a comment
Know the answer?
Add Answer to:
The PredatoryCreditCard class of Section 2.4.1 provides a process month method that models the completion of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In the summer of 2017, Reigh Webster and her friend Ella Hill were relaxing in a...

    In the summer of 2017, Reigh Webster and her friend Ella Hill were relaxing in a local watering hole complaining about their boring monotonous jobs. Reigh told Ella that she has been saving her money and is looking for a lucrative opportunity to invest in and get out of the day-to-day grind at the office. Ella indicated she had been doing the same. An executive walked up to the table and indicated he had overheard Reigh and Ella’s conversation and...

  • And there was a buy-sell arrangement which laid out the conditions under which either shareholder could...

    And there was a buy-sell arrangement which laid out the conditions under which either shareholder could buy out the other. Paul knew that this offer would strengthen his financial picture…but did he really want a partner?It was going to be a long night. read the case study above and answer this question what would you do if you were Paul with regards to financing, and why? ntroductloh Paul McTaggart sat at his desk. Behind him, the computer screen flickered with...

  • Mashaweer is the first personal service company in Egypt. It’s purely dedicated to saving its clients’...

    Mashaweer is the first personal service company in Egypt. It’s purely dedicated to saving its clients’ time and effort by offering a personal assistant 24 hours a day. The personal assistant is a rider with a motorcycle who runs any errands for individual clients or corporations at any given time. The most common service they provide is buying groceries or other goods from stores, paying bills, and acting as a courier. Mashaweer’s success relies heavily on their flexibility, and they...

  • The PTL CLub - Jim and Tammy Faye Bakker I need help with the discussion questions listed at the bottom... THE PTL CLUB...

    The PTL CLub - Jim and Tammy Faye Bakker I need help with the discussion questions listed at the bottom... THE PTL CLUB Jim and Tammy Faye Bakker launched the PTL Club in January 1974. This show was one of the most successful television ministries for more than a decade. The broadcast of the PTL Club utilized almost 200 television stations to reach a national audience of approximately 12 million viewers. PTL stood for both “Praise the Lord” and “People...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT