Implementation of programming assigment 2