implemented task 1 in cocoa app