completion of programming assignment 2