Advertisement
pranjalA

LLD

Oct 3rd, 2023
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. // write your code here...
  2. Overview:
  3. Requirement:
  4. 1. User should be able to create the transaction
  5. 2. Initially, users are the part of group
  6. 3. SettleUp for a particulr user
  7. 4. Need to maintain the history of transactions for every user
  8.  
  9. Assumption:
  10. users are registered already
  11.  
  12. ===================================
  13.  
  14. NFR:
  15. 1
  16. ======================================
  17. Requirements
  18. Users can register and update their profiles
  19. A user's profile should contain at least their name, phone number and password
  20. Users can participate in expenses with other users
  21. Users can participate in groups.
  22. 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.
  23. A user can see their total owed amount
  24. A user can see a history of the expenses they're involved in
  25. A user can see a history of the expenses made in a group that they're participating in
  26. Users shouldn't be able to query about groups they are not a member of
  27. Only the user who has created a group can add/remove members to the group
  28. 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.
  29. 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.
  30.  
  31. Good to Have Requirements
  32. When settling a group, we should try to minimize the number of transactions that the group members should make to settle up.
  33. ============================================================================
  34.  
  35. class User{
  36. int id;
  37. String name;
  38. String phone;
  39. String password;
  40. User(int id,String name,String phone,String password){
  41.  
  42. }
  43. UserService us;
  44. }
  45.  
  46. class userservice{
  47.  
  48.  
  49. ExpenseService expservice;
  50. GroupService grpservice;
  51. }
  52. class GroupService()
  53.  
  54. {
  55. createGroup
  56. addUsertoGroup()
  57. }
  58.  
  59. class GroupRepository()
  60. {
  61. List<Group>
  62. }
  63. class ExpenseService{
  64. void addExpense()
  65. {
  66.  
  67. }
  68. }
  69. class Expenses{
  70. String description;
  71. User user;
  72. int amount;
  73. }
  74.  
  75. class Group{
  76. int id;
  77. String name;
  78. String created_by;
  79. List<User> users;
  80. List<Expenses> expenses;
  81.  
  82. }
  83.  
  84. class RegisterUser{
  85. List<User> users;
  86. User addUser(int id,String name,String password){
  87. User u=new user();
  88. users.add()
  89. }
  90. }
  91.  
  92. class GroupService{
  93. Map<Integer,Group> groupMap=new HashMap<>();
  94. Group addUserToGroup(User user){
  95.  
  96.  
  97. }
  98.  
  99.  
  100.  
  101. }
  102.  
  103. class SplitwiseApplication{
  104. public static void main(String args[]){
  105. RegisterUser.addUser(id,name,password);
  106. GroupService.adduserToGroup(int user1,int user2,int groupId)
  107.  
  108.  
  109. }
  110.  
  111. void addExpenses(){
  112.  
  113.  
  114. }
  115. }
  116.  
  117.  
  118.  
  119.  
  120.  
  121. }
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement