Build a PaymentProcessor Interface

Hard Abstraction & Interfaces PRO
🔒 Login to Unlock

Problem Statement

Design an ABC `PaymentProcessor` with an abstract method `process_payment(amount)`. Create two concrete implementations: `CreditCard` and `PayPal`. Read an input amount. Call process on both, printing ‘CreditCard processing: [amount]’ and ‘PayPal processing: [amount]’.

Input Format

A single float amount.

Output Format

Print the processing logs on separate lines.

Constraints

Amount >= 0

Sample Input

150.5

Sample Output

CreditCard processing: 150.5
PayPal processing: 150.5

Explanation

A complete example of using abstract base classes to define a unified API contract for diverse payment strategies.

Starter Code

import abc

class PaymentProcessor(abc.ABC):
    # Define abstract method
    pass

class CreditCard(PaymentProcessor):
    pass

class PayPal(PaymentProcessor):
    pass

if __name__ == '__main__':
    amount = float(input())
    # Instantiate and process
    pass

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used