-
Notifications
You must be signed in to change notification settings - Fork 47
Open
Labels
Question & AssignmentFurther information is requestedFurther information is requested
Description
Objective:
Use Python classes and inheritance to model a credit card transaction system that tracks customers, their credit cards, and transaction history.
Requirements:
1 Create a base class Customer
- Attributes:
customer_id,customer_name - Method:
display_customer_info()– Returns a string with customer ID and name.
2 Create a class CreditCard that inherits from Customer
- Attributes:
card_type(e.g., Amex, Visa),card_number - Method:
display_card_info()– Returns a string with card type and number.
3 Create a class Transaction that inherits from CreditCard
- Attributes:
transaction_id,amount - Method:
display_transaction_info()– Returns a string with transaction ID and amount.
4 Create a class TransactionSummary that inherits from Transaction
- Attributes:
total_transaction_amount - Method:
calculate_total_amount()– Takes a list of transactions and sums the amounts for the customer.
Tasks:
- Create at least three transaction objects for a single customer (e.g., two for a Visa card, one for an Amex card).
- Store all details for each transaction.
- Calculate the total transaction amount for the customer using
calculate_total_amount(). - Print all details: Customer Info, Card Info for each card, Transaction Info for each transaction, and Total Transaction Amount.
Example Output:
Customer ID: C301 Customer Name: Michael Brown
Card Type: Visa Card Number: 123456789012
Transaction ID: T001 Amount: 1500
Transaction ID: T002 Amount: 2200
Card Type: Amex Card Number: 987654321098
Transaction ID: T003 Amount: 1800
Total Transaction Amount: 5500
Bonus:
Add a method to update the amount for any transaction and display a confirmation message.
patildahesh
Metadata
Metadata
Assignees
Labels
Question & AssignmentFurther information is requestedFurther information is requested