Skip to content

[CODE]: Polymorphism: Payment System #155

@patil-rushikesh

Description

@patil-rushikesh

Problem Description:
Create a Payment System that allows the user to make payments through different methods (Credit Card, PayPal, Cash). Use polymorphism to define different payment methods using the same interface.

Location:
https://github.com/patil-rushikesh/cpp_programs/tree/main/Examples

Attributes:
Payment class (base class):
amount (float) – Amount to be paid.
CreditCard class:
cardNumber (string) – Credit card number.
expirationDate (string) – Expiry date of the credit card.
CVV (int) – Card Verification Value.
PayPal class:
email (string) – PayPal account email.
Cash class:
No additional attributes for cash payments.

Methods:
pay() – The method for processing a payment (to be overridden in each derived class).
The program should be menu-driven, allowing the user to:

  1. Choose a payment method (Credit Card, PayPal, Cash).
  2. Enter payment details.
  3. Process the payment (using the appropriate method based on the user's choice).
  4. Exit the program.

Requirements for the Issue:

  1. Create the base class Payment.
  2. Implement derived classes for CreditCard, PayPal, and Cash.
  3. Use function overriding to implement pay() differently for each payment method.
  4. Provide a menu-driven interface for interacting with the system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions