Having trouble on solving the following tasks

Changing code that you posted a while ago is a dirty trick. Please do not do that again. Post the code in a new reply.