dogyears - if age < 0 puts...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#! usr/bin/ruby # The Dog year calculator program called dogyears.rb # get the original age def dogyears puts "Enter your age (in human years): " age = gets.to_i # String to Integer method puts # do some range checking, then print result
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if age < 0 puts "Negative age?!? I don't think so." elsif age < 3 or age > 110 puts "Frankly, I don't believe you." else puts "That's #{age*7} in dog years." end end dogyears...
View Full Document

Ask a homework question - tutors are online