Bird
0
0

In a system with User, Group, and Expense classes, which class should track who paid for an expense?

easy📝 Conceptual Q2 of 15
LLD - Design — Splitwise (Expense Sharing)
In a system with User, Group, and Expense classes, which class should track who paid for an expense?
AGroup class
BUser class
CPayment class
DExpense class
Step-by-Step Solution
Solution:
  1. Step 1: Identify responsibility of Expense class

    Expense class represents costs and payments, so it should track who paid.
  2. Step 2: Exclude other classes

    User class holds user info, Group class holds users, Payment class is not defined here.
  3. Final Answer:

    Expense class -> Option D
  4. Quick Check:

    Who paid expense = Expense class [OK]
Quick Trick: Payment info belongs in Expense class [OK]
Common Mistakes:
  • Assigning payment info to User class
  • Confusing Group class with payment tracking
  • Assuming Payment class exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes