Overview
The Group Event Expense Splitter App is designed to help users divide shared expenses among a group of people for events, trips, or social gatherings. Each user can enter their expenses, and the app calculates how much each person owes or is owed, ensuring that no one overpays or underpays.
The app will use object-oriented principles to ensure clear structure, maintainability, and scalability. We will design the system using key concepts of object-oriented design (OOD) such as classes, objects, inheritance, and composition.
Core Requirements
-
User Management: Users should be able to sign up, log in, and create/join events.
-
Event Management: Users can create an event, add expenses, and invite participants.
-
Expense Management: Users can input the expenses they’ve paid for, categorizing them as shared or individual.
-
Expense Splitting: The app automatically divides expenses equally or based on custom criteria (e.g., by percentage or amount).
-
Balance Calculation: The app tracks how much each person owes or is owed and calculates the total balance for each participant.
-
Notifications: Alerts when new expenses are added, or the balance is updated.
Key Classes and Relationships
1. User
This class represents a user of the app. Users can add expenses, join events, and view their balances.
2. Event
This class represents an event where expenses are shared. It contains a list of users and expenses for the event.
3. Expense
This class represents an expense within an event. Each expense has a payer, participants, and the amount paid. The app calculates how to split this expense among the participants.
4. Transaction
This class will keep track of all transactions for each user. This includes credits (how much they are owed) or debits (how much they owe).
Workflow
-
Creating an Event:
-
A user (the event creator) creates an event, adding basic information like event name, date, and location.
-
-
Adding Participants:
-
The event creator can invite users to join the event. Each user adds their details to the event.
-
-
Entering Expenses:
-
Users input their expenses. They can indicate whether the expense is shared or not.
-
If it’s shared, it is split evenly among all participants.
-
Each user can see the total amount they have paid for the event.
-
-
Expense Calculation:
-
The app calculates how much each user owes or is owed based on the total expenses and the amount they have contributed.
-
The system checks how much each participant paid and how the expense should be divided.
-
-
Balancing the Accounts:
-
The app automatically generates transactions to balance out how much each user owes or is owed.
-
Users can view a summary of the balances and settle any outstanding amounts.
-
-
Settling Debts:
-
The app tracks payments and ensures that the debts are paid off.
-
Sample Usage
Example Output
In this case, Alice has overpaid and is owed $50, while Bob and Charlie each owe $25.
Conclusion
This design leverages the power of object-oriented design to manage users, events, and expenses efficiently. By using classes like User, Event, Expense, and Transaction, we can scale the app and maintain clean, modular code. The app will provide users with a simple interface to manage group expenses, automatically balancing payments to ensure fairness.