I've just finished an enchantment calculator. It calculates the probability of you gaining a particular enchantment for that prized posession you've been saving up for.
I was going to get the program to work out the actual probability using probability theory, but looking at the algorithm used, that is just not going to happen.
Instead this uses a brute force method to run through the algorithm (as given on the wiki - http://www.minecraftwiki.net/wiki/Enchanting) 1000 times. Once this is done, the probability of gaining a particular enchantment can be calculated.
It also has a mode whereby you can run it once to see what enchantments you might have gotten for a given instance.
The program takes 3 inputs:
All the values are hard coded (embeded xml) (because I wrote this in a hurry), but I have released the source.
If the rules ever change, it should be fairly straight forward to update.