Home‎ > ‎Luc‎ > ‎Software Applications‎ > ‎

Bills Calculator

This application takes in a number of people and their share of bills, and calculates who owes what to who.

This program will take in any number (be reasonable) of bills, and split them between a number of people. The idea is that everyone is responsible for one bill. Let me give you an example. Lets say you have four people, Marty, Luc, Todd, Calvin. These people each have bills sent to their name, but in the end everyone shares. So, let's say Marty's is 10$, Luc's 20$, Todd's 30$, Calvin's 40$. So, what we could do is the following. We could take Marty's, split it in 4, which gives 2.50$, and then every person would owe him that amount. Then, Luc does the same thing, which turns out to being 5$ each. So, if the two others do this, it ends up that there will be 12 total transactions.

The program I created minimized the total number of transactions. It basically checks to see who paid more then their total share, and then runs a loop that collects the money from the people who paid barely nothing of the share. I'll post the code here. Just click on it to check it out for fun.


Download below in the attachments section. The code and binary is included in the zip file.

ċ
bills.zip
(252k)
lucgallant,
21 Oct 2008, 20:53
Comments