Class: BodyMassIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/bmi-gaboisc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#heightObject

Returns the value of attribute height.



2
3
4
# File 'lib/bmi-gaboisc.rb', line 2

def height
  @height
end

#weightObject

Returns the value of attribute weight.



2
3
4
# File 'lib/bmi-gaboisc.rb', line 2

def weight
  @weight
end

Instance Method Details

#calculate_indexObject



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