Class: PHImc::Pessoa

Inherits:
Object
  • Object
show all
Defined in:
lib/PH_imc.rb

Overview

Your code goes here…

Instance Method Summary collapse

Instance Method Details

#calculo_imcObject

Metodo que calcula o imc



16
17
18
19
# File 'lib/PH_imc.rb', line 16

def calculo_imc
imc = @peso/(@altura**2)
return "Seu IMC É: #{imc.round(2)} kg/m²."
end

#peso_alturaObject

Metodo que solicita peso e altura do usuario



8
9
10
11
12
13
14
# File 'lib/PH_imc.rb', line 8

def peso_altura
print "Informe sua altura: "
@altura= gets.to_f
print "Informe seu peso: "
@peso = gets.to_f
return ""
end