Top Level Namespace
Defined Under Namespace
Modules: Z16020tmTmoriai
Instance Method Summary collapse
- #calcage(year, month, day) ⇒ Object
- #calcall(num1, num2) ⇒ Object
- #calcbmi(height, weight) ⇒ Object
- #convertMessage(message) ⇒ Object
Instance Method Details
#calcage(year, month, day) ⇒ Object
4 5 6 7 8 |
# File 'lib/z16020tm_tmoriai.rb', line 4 def calcage(year, month, day) d1 = Date.new(year, month, day).strftime("%Y%m%d").to_i d2 = Date.today.strftime("%Y%m%d").to_i puts (d2-d1) / 10000 end |
#calcall(num1, num2) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/z16020tm_tmoriai.rb', line 18 def calcall(num1, num2) print "sum:#{num1 + num2}\n" print "difference:#{num1 - num2}\n" print "product:#{num1 * num2}\n" if num2 != 0 print "quotient:#{num1 / num2}" else print "num2 is not 0" end end |
#calcbmi(height, weight) ⇒ Object
10 11 12 |
# File 'lib/z16020tm_tmoriai.rb', line 10 def calcbmi(height, weight) puts weight / (height * height) end |
#convertMessage(message) ⇒ Object
14 15 16 |
# File 'lib/z16020tm_tmoriai.rb', line 14 def convertMessage() puts .swapcase end |