in-class exercise solution