Each time I enjoy some vacations with friends, there are many situations when someone needs to pay for the whole group, or even for a smaller group of persons. At the end of the holidays, everyone owes money to everyone... not much enjoyable to handle that by hand.

The program

Therefore I've written a Perl program, which takes a description file and computes out of it an efficient solving of owes.

Here's an example of a description file:

# -*- fundamental -*-

%group arrived-on-monday gc francois jacques
%group took-the-train gc phil

	took-the-train    70.2 each      # train tickets
	307				 # food
	gc jacques        100            # first evening late night drinks

	arrived-on-monday 170            # first evening restaurant


	250				 # drink

As you can see, it's rather simple:

Here's what the program gives:

Person gc:
        Paid in total:          547.40
        Owed to him/her total:  259.13
Person phil:
        Paid in total:          250.00
        Owed to him/her total:  150.00
        Owe to: gc               81.60
Person francois:
        Paid in total:          170.00
        Owed to him/her total:   56.67
        Owe to: phil             50.00
        Owe to: gc                4.73
Person jacques:
        Paid in total:            0.00
        Owed to him/her total:    0.00
        Owe to: phil             50.00
        Owe to: francois         56.67
        Owe to: gc              111.40
Person samuel:
        Paid in total:            0.00
        Owed to him/her total:    0.00
        Owe to: phil             50.00
        Owe to: gc               61.40

Proposed owes solving:
        jacques      gives  218.07 to gc 
        samuel       gives   68.40 to phil 
        samuel       gives   41.07 to gc 
        samuel       gives    1.93 to francois 

Download the program:

Last updated: Sat Jan 19 22:53:10 2008
Valid XHTML 1.0!