completed Prog. Assignment 2