Lecture_Notes/imperfect_notes/pragy/Machine Coding Splitwise.md
2020-03-19 12:51:33 +05:30

1.3 KiB

Machine Coding Splitwise

Create Splitwise

  • Has everyone used splitwise?

  • Social expense management app

  • Simplifies bookkeeping amongst groups

  • start coding? yay? \o/

  • no. Requirements first

Requirements

  • A user can add an expense. While adding the expense, the amount can be split amongst any other users
  • Expense can be of 3 types
    • split equally
      • take care of missing money
    • unequal: value
    • unequal: percentage
  • The total expense must add up to 100% (or the total money value)
  • Proper validation must be done for the expense
    • 2 decimals, because currency
    • 2 decimals for % as well
  • Users must have their details
  • Show expenses of user
  • show balance report of all users
  • Show balance report of a user against all users
    • don't show user if s/he has 0 balance against a user

Input format

  • record expense
    • who_paid
    • people in the group
    • expense type - equal/exact/percent
    • if expense is unequal - the values
  • show all - current balances
  • show userid - current balance
  • passbook userid - history
  • simplify expenses

a -100-> b b -100-> c

a -100-> c

Output format