Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cash Flow Minimizer (Java 17 Console App)

A complete Java console application that minimizes the number of cash-settlement transactions among people.


🚀 Features

  • Pure Java 17+: No external libraries required.
  • Object-Oriented Design: Dedicated Person model.
  • Interactive Menu:
    1. Run with custom input
    2. Test sample
    3. Exit
  • Flexible Input Formats:
    • Num txns N
    • N
    • Followed by N lines of Payer Payee Amount
  • Efficient Algorithm:
    • Computes net balances using HashMap<String, Integer>.
    • Builds debtor/creditor lists and minimizes transactions with a greedy two-pointer approach.
  • Robust Handling:
    • Zero balances
    • Exact matches
    • Multiple cycles
  • CSV Export: Optional export of minimized payments.
  • Standalone Tests: No JUnit dependency.

📂 Project Structure

  • src/CashFlowMinimizer.java → Main app, algorithm, menu, CSV persistence.
  • src/Person.java → OOP model for settlement participants.
  • src/Test.java → Standalone test runner for correctness.
  • docs/console-demo.svg → Demo screenshot image.

🛠️ Getting Started

Prerequisites

  • Java 17 or higher

Running the Application

  1. Clone the repository:
    git clone <repository-url>
  2. Navigate to the project directory:
    cd cashflow-minimizer-java
  3. Compile the project:
    javac src/*.java
  4. Run the application:
    java src/CashFlowMinimizer

Running Tests

  1. Compile the test file:
    javac src/Test.java
  2. Run the tests:
    java src/Test

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix:
    git checkout -b feature-name
  3. Commit your changes:
    git commit -m "Add your message here"
  4. Push to your branch:
    git push origin feature-name
  5. Open a pull request.

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.


⭐ Star this repo if you find it helpful! ⭐

About

A Java console application to optimize and minimize cash-settlement transactions among participants. Features an interactive menu, efficient algorithms, and standalone tests.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages