An open API service indexing awesome lists of open source software.

https://github.com/vishalku03/cash-flow-minmiser

This is a program that allows users to split expenses with friends or colleagues. If a group needs to share the cost of a particular bill, the Cash Flow Minimiser will make sure that each person who paid money, gets reimbursed with the correct amount. This is also done using the minimum number of transactions.
https://github.com/vishalku03/cash-flow-minmiser

css dsa graph html javascript multiset react

Last synced: 3 months ago
JSON representation

This is a program that allows users to split expenses with friends or colleagues. If a group needs to share the cost of a particular bill, the Cash Flow Minimiser will make sure that each person who paid money, gets reimbursed with the correct amount. This is also done using the minimum number of transactions.

Awesome Lists containing this project

README

          

# Cash Flow Minimiser

This is a program that allows users to split expenses with friends or colleagues. If a group needs to share the cost of a particular bill, the Cash Flow Minimiser will make sure that each person who paid money, gets reimbursed with the correct amount. This is also done using the minimum number of transactions.

## Video

https://user-images.githubusercontent.com/76661350/151113470-62df1428-0c25-4019-a5ee-25353530752c.mp4

## Installation

Clone the repository

`git clone https://github.com/vishalku03/Cash-Flow-Minmiser`

`cd Cash-Flow-Minmiser`

Check package.json file and ensure scripts are notated as below:

```
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
```

Delete the node_modules folder and any 'lock' files such as
yarn.lock or package-lock.json if present.

Install required packages

`npm install`

Run the server

`npm start`

## How does it work?
Approach to solving this problem:
First, we take in all the transactions and exchanges that have happened among the group of people. We use a function which is used to calculate every individual's net balance.

Based on their net balances, we can segregate the people into 2 categories -


  • those under credit

  • those under debit

A person is said to come under credit if his/ her net balance is greater than 0. This means that this person has to get his money back.
Likewise, a person is said to come under debit if his/ her balance is lesser than 0. This means this person owes money to someone else.
(If the net balance of an individual is 0, that means that he/ she need not give nor receive any money and they have been settled.
Such people will no longer be taken into consideration for further transaction settlements).

Eg: If Tarun pays ₹100 to Yash, then we can say that Tarun has to be reimbursed ₹100 which means his net balance is 100 and he is under credit.
Likewise, Yash who borrowed money has to pay Tarun back ₹100 as he is in debt. So, Yash has a net balance of -100. Once this has been settled, both their balances become 0.

Next, from among the people who are in debit, we pick the person with the largest debit.
Then, among the people who are under credit, pick the person with the largest credit.
We start off by settling these 2 values. Once they have been settled, we take the person with the next largest credit and the next largest debit and settle these 2.
This process continues until every person has been settled.

This can be achieved using a Max Heap.
This is the solution we follow to implement our Cash Flow Minimiser.

HERE OVERVIEW :-

1. JavaScript: The primary programming language used for the project.
2. React: A JavaScript library for building user interfaces, used for creating dynamic and interactive components.

Data Structures:

3. Arrays: For storing lists of transactions and users.
4. Objects: For representing individual transactions and users.
5. Graphs: For modeling relationships and transactions between users.
6. Graph Algorithms: Used to optimize and minimize cash flow by identifying cycles and simplifying transactions.
7. State Management: Managing the state of the application, likely using React’s state management features.
8. Hooks: React hooks like useState and useEffect for managing component state and side effects.
9. Components: Modular and reusable UI components built with React.
10. Event Handling: Managing user interactions and events within the application.
11. API Integration: Fetching and sending data to a backend server or external APIs (if applicable).

12. CSS/Styling: Styling the application to make it visually appealing and user-friendly.

S0,
These concepts work together to create a functional and efficient application for minimizing cash flow among multiple transactions.