module Z15014amCalcUtils
Constants
- VERSION
Public Class Methods
calcBMI(height,weight)
click to toggle source
# File lib/z15014am_calcUtils.rb, line 5 def self.calcBMI(height,weight) puts "Your BMI is " + (weight/(height*height)).to_s end
calcDistance(lat1,lon1,lat2,lon2)
click to toggle source
# File lib/z15014am_calcUtils.rb, line 9 def self.calcDistance(lat1,lon1,lat2,lon2) r = 6378.137; lat1 = lat1 * PI / 180; lon1 = lon2 * PI / 180; lat2 = lat2 * PI / 180; lon2 = lon2 * PI / 180; puts "The Distance is "+(r * acos(sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1))).to_s+" km"; end