class IMC

Constants

VERSION

Attributes

altura[R]
edad[R]
peso[R]
sexo[R]

Public Class Methods

new(a,b,c,d) click to toggle source
# File lib/NutrientesEdu/IMC.rb, line 6
def initialize(a,b,c,d)
        @peso=a
        @altura=b
        @edad=c
        @sexo=d
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/NutrientesEdu/IMC.rb, line 25
    def <=> (other)
   calcular_imc <=> other.calcular_imc
end
calcular_imc() click to toggle source
# File lib/NutrientesEdu/IMC.rb, line 13
def calcular_imc
        (@peso)/(@altura*@altura)
end
porcentaje_grasa() click to toggle source
# File lib/NutrientesEdu/IMC.rb, line 17
def porcentaje_grasa
        ((1.2*calcular_imc)+(0.23*edad)-(10.8*sexo)-5.4)
end
to_s() click to toggle source
# File lib/NutrientesEdu/IMC.rb, line 21
def to_s
        "#{@peso} #{@altura} #{@edad} #{@sexo}"
end