completed exercise5.rb