Assignment #6, corrected solution_6.rb