Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // write your code here...
- Overview:
- Requirement:
- 1. User should be able to create the transaction
- 2. Initially, users are the part of group
- 3. SettleUp for a particulr user
- 4. Need to maintain the history of transactions for every user
- Assumption:
- users are registered already
- ===================================
- NFR:
- 1
- ======================================
- Requirements
- Users can register and update their profiles
- A user's profile should contain at least their name, phone number and password
- Users can participate in expenses with other users
- Users can participate in groups.
- To add an expense, a user must specify either the group, or the other users involved in the expense, along with who paid what and who owes what. They must also specify a description for the expense.
- A user can see their total owed amount
- A user can see a history of the expenses they're involved in
- A user can see a history of the expenses made in a group that they're participating in
- Users shouldn't be able to query about groups they are not a member of
- Only the user who has created a group can add/remove members to the group
- Users can request a settle-up. The application should show a list of transactions, which when executed will ensure that the user no longer owes or recieves money from any other user. Note that this need not settle-up with any other users.
- Users can request a settle-up for any group they're participating in. The application should show a list of transactions, which if executed, will ensure that everyone participating in the group is settled up (owes a net of 0 Rs). Note that will only deal with the expenses made inside that group. Expenses outside the group need not be settled.
- Good to Have Requirements
- When settling a group, we should try to minimize the number of transactions that the group members should make to settle up.
- ============================================================================
- class User{
- int id;
- String name;
- String phone;
- String password;
- User(int id,String name,String phone,String password){
- }
- UserService us;
- }
- class userservice{
- ExpenseService expservice;
- GroupService grpservice;
- }
- class GroupService()
- {
- createGroup
- addUsertoGroup()
- }
- class GroupRepository()
- {
- List<Group>
- }
- class ExpenseService{
- void addExpense()
- {
- }
- }
- class Expenses{
- String description;
- User user;
- int amount;
- }
- class Group{
- int id;
- String name;
- String created_by;
- List<User> users;
- List<Expenses> expenses;
- }
- class RegisterUser{
- List<User> users;
- User addUser(int id,String name,String password){
- User u=new user();
- users.add()
- }
- }
- class GroupService{
- Map<Integer,Group> groupMap=new HashMap<>();
- Group addUserToGroup(User user){
- }
- }
- class SplitwiseApplication{
- public static void main(String args[]){
- RegisterUser.addUser(id,name,password);
- GroupService.adduserToGroup(int user1,int user2,int groupId)
- }
- void addExpenses(){
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement