complete code for ex17