This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a service deployed into CoreRest app | |
# http://corerest.appspot.com/run/calculate-simple-interest-rate | |
# A service to calculate a simple interest rate. | |
# http://math.about.com/od/businessmath/ss/Interest.htm | |
# The service receives principal, rate and time to calculate. | |
# Things to remember: | |
# 1) If you want to send a decimal value, you should use a "." to | |
# separate decimal, like "9.5". | |
# 2) Simple Interest calculation is based on Principal * Rate * Time. | |
# So, if you want $4500 at 9.5% for 6 years, the URL to use would be: | |
# http://corerest.appspot.com/service/calculate-simple-interest-rate/4500/9.5/6 | |
($principal.to_f * ($rate.to_f/100) * $time.to_f).to_s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment