Skip to content

Conversation

@adityacosmos24
Copy link
Contributor

@adityacosmos24 adityacosmos24 commented Oct 30, 2025

image ## PR: Discount Coupon System Implementation

Overview

This pull request adds a Discount Coupon System, showcasing the design and application of coupon-based discounts in an application. The solution demonstrates extensible object-oriented design, allowing for different types of coupons and discount strategies to be easily integrated.

Key Features

  • Coupon Abstraction:
    Defines an abstract class or interface for coupons, ensuring a consistent contract for all discount policies.
  • Multiple Coupon Types:
    Implements various coupon types (percentage-based, amount-based, etc.) to demonstrate the flexibility of the system.
  • Strategy/Policy Pattern Usage:
    Applies relevant design patterns to encapsulate variable discounting logic.
  • Composability:
    Designed such that adding new coupon types or modifying existing ones requires minimal future changes.
  • End-to-End Flow:
    Provides main/test classes demonstrating how customers can apply, combine, or validate coupons during checkout or billing.

Code Structure

  • Core Coupon Logic:
    • Coupon abstractions/interfaces (e.g., Coupon.h, Coupon.cpp)
    • Concrete implementations for each coupon type
  • Demonstration/Test Files:
    • Main application file showing example scenarios
    • Test cases for different coupon applications

Design Principles Applied

  • Open/Closed Principle—easy to add new coupon strategies without modifying core system logic.
  • Single Responsibility Principle—separation of coupon logic from customer and billing logic.
  • Encapsulation—each coupon’s logic is self-contained.

Review Checklist

  • Code compiles and runs as expected
  • Test/demo cases cover different coupon scenarios
  • Well-documented and organized class structure
  • New coupon types can be added with minimal changes

closses #43

@prajwal3114 prajwal3114 merged commit aef22ff into OPCODE-Open-Spring-Fest:main Oct 30, 2025
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment