implementation of assignment1 task1