Coding: final assignment

Help needed. I have been struggling with this assignment and was hoping that you could help me. The assignment is as follow: