Already finished task 1-3. In task 3, I wrote two version due to that I am not so clear about the question requirement.