solution for methods exercise 3