PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Envoy

Design a shopping cart with coupons and tax

Last updated: Mar 29, 2026

Quick Overview

Evaluates object-oriented design, domain modeling, encapsulation/immutability, and extensible pricing/discount strategies within the Software Engineering Fundamentals domain at a component-level/class-interface design abstraction.

  • easy
  • Envoy
  • Software Engineering Fundamentals
  • Software Engineer

Design a shopping cart with coupons and tax

Company: Envoy

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: easy

Interview Round: Technical Screen

Design an object-oriented shopping cart module for an e-commerce system. Requirements: - A cart can **add items** and **update item quantities**. - The cart supports **checkout**. After checkout, the cart becomes **immutable** (no further changes to items/quantities/coupons). - The cart can **apply coupons**. There may be multiple coupon types, for example: - **Percentage off** (e.g., 20% off) - **BOGO** (Buy-One-Get-One) style discounts - The cart must compute **tax** based on a **state tax rate**. - The prompt is intentionally vague: explain what clarifying questions you would ask, then propose a clean class/interface design and describe how totals are calculated. Deliverables: - Key classes and responsibilities (e.g., Cart, LineItem, Product, Pricing/Discount/Tax components). - Core methods and data structures. - How you prevent modification after checkout. - How you model different coupon types and make it easy to add new ones.

Quick Answer: Evaluates object-oriented design, domain modeling, encapsulation/immutability, and extensible pricing/discount strategies within the Software Engineering Fundamentals domain at a component-level/class-interface design abstraction.

Envoy logo
Envoy
Mar 11, 2026, 12:00 AM
Software Engineer
Technical Screen
Software Engineering Fundamentals
9
0

Design an object-oriented shopping cart module for an e-commerce system.

Requirements:

  • A cart can add items and update item quantities .
  • The cart supports checkout . After checkout, the cart becomes immutable (no further changes to items/quantities/coupons).
  • The cart can apply coupons . There may be multiple coupon types, for example:
    • Percentage off (e.g., 20% off)
    • BOGO (Buy-One-Get-One) style discounts
  • The cart must compute tax based on a state tax rate .
  • The prompt is intentionally vague: explain what clarifying questions you would ask, then propose a clean class/interface design and describe how totals are calculated.

Deliverables:

  • Key classes and responsibilities (e.g., Cart, LineItem, Product, Pricing/Discount/Tax components).
  • Core methods and data structures.
  • How you prevent modification after checkout.
  • How you model different coupon types and make it easy to add new ones.

Solution

Show

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Envoy•More Software Engineer•Envoy Software Engineer•Envoy Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.