Top Level Namespace

Defined Under Namespace

Modules: A1624Bmi

Instance Method Summary collapse

Instance Method Details

#compute(mass, height) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/a1624_bmi.rb', line 3

def compute(mass, height)
  bmi = mass / (height * height)
  p sprintf("BMI = %.1f", bmi)
  if bmi < 18.5 then
    print("thin")
  elsif bmi < 25.0 then
    print("normal")
  elsif bmi < 30.0 then
    print("fat level one")
  elsif bmi < 35.0 then
    print("fat level two")
  elsif bmi < 40.0 then
    print("fat level three")
  else
    print("fat level four")
  end
end