The case and task is given below in the description section.