programming excercise #6 solved