We really cannot help you.
Mostly because we have no idea what the old app looks like, or what maths it may be using - so we are as in the dark as you!
And we aren't a "code to order" service - while we are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you!
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide
] but you may have to pay someone to do the work for you - you can try Freelancer.com who are a "code to order" service, albeit paid for.
But be aware: you get what you pay for. Pay peanuts, get monkeys.