Here is code to help you with part (c)