Completed ex6.3.rb