assumed instructor's solution for assignment6