To calculate real time shipping rates you will need to use the USPS Developer API and UPS API. For both you will need to obtain a sandbox account and credentials before implementing in a production environment.
The key ingredients to calculating the shipping rates will be:
Those are the key concepts shared between both web services. Given that information on your end you can implement the request for the shipping rates as outlined in the help docs for UPS and USPS API.
The first thing I would recommend having integrated a normalized shipping API for fedex, ups and usps would to read the docs. You aren't going to get anywhere unless you understand the information required to make the request and how it differs across each API. There are so many variables to consider, reading the docs will be the most important step leading to implementation.
What you have been tasked to do is not a simple unless there is a plug-in with the functionality required for the software that your working with. Otherwise, its actually a very research intensive and complex process.