How do you calculate a reasonable transaction fee? These days transactions are taking a very long time to confirm. Higher transaction fees could be a possible solution. I want to know how to calculate a reasonable transaction fee, which is not so expensive and results in less time until confirmation (within 10-15min). Could you advice me on how to implement it?
See https://bitcoinfees.21.co/ for mempool size and tx fee. This will suggest fee in satoshi/byte depending on current network conditions.

If you are looking to exact fee in BTC for spending from wallet, you can try  https://github.com/shivaenigma/btxfees.