write ex7.rb, ex8.rb, and ex9.rb