completed upto ex9.rb