Module: Z15014amCalcUtils
- Defined in:
- lib/z15014am_calcUtils.rb,
lib/z15014am_calcUtils/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Class Method Details
.calcBMI(height, weight) ⇒ Object
5 6 7 |
# 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) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# 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 |