exercise2 for class