completed exercise7.rb with the bonus