Skip to content

Instantly share code, notes, and snippets.

@dwildt
Created August 26, 2010 05:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dwildt/550856 to your computer and use it in GitHub Desktop.
# 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