class Paciente

Attributes

actfis[R]
peso[R]
talla[R]

Public Class Methods

new(nombre, apellido, edad, genero, peso, talla, actfis) click to toggle source
Calls superclass method Persona::new
# File lib/alu0100987522/individuo.rb, line 26
def initialize(nombre, apellido, edad, genero, peso, talla, actfis)
   super(nombre, apellido, edad, genero)
   @peso = peso
   @talla = talla
   @actfis = actfis
   @genero = genero
   @edad = edad
end

Public Instance Methods

<=>(another) click to toggle source
# File lib/alu0100987522/individuo.rb, line 61
def <=>(another)
imc_calculo <=> another.imc_calculo
end
efecto_termogeno() click to toggle source
# File lib/alu0100987522/individuo.rb, line 76
def efecto_termogeno
    gasto_energetico_basal() * 0.10
end
gasto_actividad_fisica() click to toggle source
# File lib/alu0100987522/individuo.rb, line 80
def gasto_actividad_fisica
   gasto_energetico_basal() * actfis 
end
gasto_energetico_basal() click to toggle source
# File lib/alu0100987522/individuo.rb, line 65
def gasto_energetico_basal 
    geb = 0
    if genero == "Masculino"
        geb = 10.0*peso + 6.25*talla - 5.0*edad + 5
    end
    if genero == "Femenino"
        geb = 10.0*peso + 6.25*talla - 5.0*edad - 161
    end
    return geb
end
gasto_energetico_total() click to toggle source
# File lib/alu0100987522/individuo.rb, line 84
def gasto_energetico_total
    gasto_energetico_basal() + efecto_termogeno() + gasto_actividad_fisica()
end
imc_calculo() click to toggle source
# File lib/alu0100987522/individuo.rb, line 35
def imc_calculo
   return @peso/(@talla*@talla) 
end
imc_clasificar() click to toggle source
# File lib/alu0100987522/individuo.rb, line 39
def imc_clasificar
    imc = imc_calculo()
    tipo = "";
    if (imc<18.5)
      tipo = "Delgado"
    elsif(imc.between?(18.5, 24.9))
      tipo = "Aceptable"
    elsif(imc.between?(25.0, 29.9))
      tipo = "Sobrepeso"
    elsif (imc>29.9)
      tipo = "Obesidad"
    else
      return "Error clasificando el imc:  #{imc}."
    end
    
    return tipo
end
to_s() click to toggle source
# File lib/alu0100987522/individuo.rb, line 57
def to_s
    return %Q(#{@nombre} #{@apellido} - Edad: #{@edad} años - Género: #{@genero} - Peso: #{@peso} kg - Talla: #{@talla} m - Factor act. física: #{@actfis}.)
end