Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

What is a standardized normal curve?

Answered: 1 week ago

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago