add ex39.rb and ex40.rb