Use the parent classes to the left to help you solve this problem. The first parent is the Person class with some very generic information. The second class, CardHolder, is the class for a credit card holder. Create the child class PlantinumClient. This class inherits all of the attributes of both parent classes. In addition, the child class has the attributes cash_back and rewards. cash_back should be set to 0.02 and rewards should be set to 0. Override the process_sale method so that 2% of each sale is added to rewards. Expected Output Declare an instance of the PlatinumClient class as shown below. platinum = PlatinumClient("Sarah", "101 Main Street", 123364) Your class should be able to execute the code below in the stated order and produce the given return values. Order Code Return Value 1 platinum.process_sale(100) N/A 2 print(platinum.rewards) 2 3 print(platinum.balance) 100 4 platinum.make_payment(50) N/A 5 print(platinum.balance) 50 6 print(platinum.get_info()) Sarah lives at 101 Main Street. In Python Programming Please # parent classes class Person: def __init__(self, name, address): self.name = name self.address = address def get_info(self): return f"{self.name} lives at {self.address}." class CardHolder: def __init__(self, account_number): self.account_number = account_number self.balance = 0 self.credit_limit = 5000 def process_sale(self, price): self.balance += price def make_payment(self, amount): self.balance -= amount # declare child class here
Use the parent classes to the left to help you solve this problem. The first parent is the Person class with some very generic information. The second class, CardHolder, is the class for a credit card holder. Create the child class PlantinumClient. This class inherits all of the attributes of both parent classes. In addition, the child class has the attributes cash_back and rewards. cash_back should be set to 0.02 and rewards should be set to 0. Override the process_sale method so that 2% of each sale is added to rewards. Expected Output Declare an instance of the PlatinumClient class as shown below.
platinum = PlatinumClient("Sarah", "101 Main Street", 123364)
Your class should be able to execute the code below in the stated order and produce the given return values.
Order |
Code |
Return Value |
1 |
platinum.process_sale(100) |
N/A |
2 |
print(platinum.rewards) |
2 |
3 |
print(platinum.balance) |
100 |
4 |
platinum.make_payment(50) |
N/A |
5 |
print(platinum.balance) |
50 |
6 |
print(platinum.get_info()) |
Sarah lives at 101 Main Street. |
In Python Programming Please
# parent classes
class Person:
def __init__(self, name, address):
self.name = name
self.address = address
def get_info(self):
return f"{self.name} lives at {self.address}."
class CardHolder:
def __init__(self, account_number):
self.account_number = account_number
self.balance = 0
self.credit_limit = 5000
def process_sale(self, price):
self.balance += price
def make_payment(self, amount):
self.balance -= amount
# declare child class here
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images