I know some Algebra and Trigonometry and Calculus. And you wanted to use Java programming to solve this problem? Slowly I'm coming along with Java programmers and what they do. I cannot see the programming implementation yet. As I'm more towards the iPhone use, cash registers, and the Basic Input/Output classes in Java. As for the solution? I don't know how this will work yet. Objected Oriented Programming.
--- Update ---
This is an engineering problem. At some server some where. The interface are from the 1.4 sdk kit. Java programming. Coming up with a programming solution I see several steps already. Separately, and in working form with the server and kit. Really nice conceptual problem. You wanted to figure out the whole programming problem though and solution. I can see how this is hard. Especially if you're doing business on the iPhone and this connects to a website. Java Programming.