class Human
Public Class Methods
new(height,weight)
click to toggle source
# File lib/bmi.rb, line 2 def initialize(height,weight) @height = height @weight = weight end
Public Instance Methods
bmi()
click to toggle source
# File lib/bmi.rb, line 11 def bmi (@weight / (@height/100 * @height/100)).round(1) end
hello()
click to toggle source
# File lib/bmi.rb, line 7 def hello puts "こんにちは。身長は #{@height}で、体重は #{@weight}です。" end
hello2()
click to toggle source
# File lib/bmi.rb, line 16 def hello2 puts "BMI値は#{bmi}です。よろしくお願いします。" end