up to task 5

Answers and program modified up to task 5.