GithubHelp home page GithubHelp logo

tiggern's Introduction

Tiggern

To start your Phoenix server:

  • Run mix setup to install and setup dependencies
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Example: Weighted Expense Splitting

Let's have 4 participants: Alice, Bob, Charlie, and David.

  • Alice is in tier 5
  • Bob is in tier 3
  • Charlie is in tier 1
  • David is in tier 0

Let's assume the following percentage contributions for each tier:

  • Tier 5 contributes 25%
  • Tier 4 contributes 20%
  • Tier 3 contributes 15%
  • Tier 2 contributes 10%
  • Tier 1 contributes 5%
  • Tier 0 contributes 0%

Now, let's say they have a bill of $100 to split.

First, we calculate the total contribution percentage from all participants which is 25% (Alice) + 15% (Bob) + 5% (Charlie) + 0% (David) = 45%.

Next, we calculate each person's share:

  • Alice's Share: (25 / 45) * 100 = $55.56
  • Bob's Share: (15 / 45) * 100 = $33.33
  • Charlie's Share: (5 / 45) * 100 = $11.11
  • David's Share: (0 / 45) * 100 = $0.00

This way, the expense gets divided according to the tiers of each participant. Please note that these are just suggested percentages for each tier. You can adjust them according to your requirements.

Prompts Used

  • I would like to build an application where expenses are split between persons. Expenses are split not equally but based on a tier that each person has. While tier 0 pays nothing, tier 5 pays a larger fraction than other tiers. If all participants had tier 3, which is the middle paying tier, they would pay the same. How can I divide an expense in this way?

tiggern's People

Contributors

leweohlsen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.