Bird
0
0

Which class should contain the method to add a new user to a group in a shared expense system?

easy📝 Conceptual Q1 of 15
LLD - Design — Splitwise (Expense Sharing)
Which class should contain the method to add a new user to a group in a shared expense system?
AUser class
BExpense class
CGroup class
DDatabase class
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of Group class

    The Group class manages collections of users, so adding a user logically belongs here.
  2. Step 2: Identify the appropriate class for user management

    User class represents individual users, Expense class handles costs, so neither manages group membership.
  3. Final Answer:

    Group class -> Option C
  4. Quick Check:

    Adding user to group = Group class [OK]
Quick Trick: Group manages users, so add user method belongs there [OK]
Common Mistakes:
  • Trying to add user in User class
  • Adding user in Expense class
  • Confusing database with class responsibility

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes