ex9 complete and tested