I have solved the first part of the problem but I can\'t find a way to edit it to make it work for the 2nd part as well. Here is the Image.
Here is what I coded for t