Added task4
Modified task1 to use arrays