Class: BodyMassIndex
- Inherits:
-
Object
- Object
- BodyMassIndex
- Defined in:
- lib/bmi-gaboisc.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
- #calculate_index ⇒ Object
-
#initialize(weight, height) ⇒ BodyMassIndex
constructor
A new instance of BodyMassIndex.
Constructor Details
#initialize(weight, height) ⇒ BodyMassIndex
Returns a new instance of BodyMassIndex.
4 5 6 7 |
# File 'lib/bmi-gaboisc.rb', line 4 def initialize(weight, height) @weight=weight @height=height end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
2 3 4 |
# File 'lib/bmi-gaboisc.rb', line 2 def height @height end |
#weight ⇒ Object
Returns the value of attribute weight.
2 3 4 |
# File 'lib/bmi-gaboisc.rb', line 2 def weight @weight end |
Instance Method Details
#calculate_index ⇒ Object
9 10 11 12 |
# File 'lib/bmi-gaboisc.rb', line 9 def calculate_index @wh = @weight / (@height * @height) puts 'El indice de masa corporal es: '+ @wh.to_s end |