Here's what you should do. If you still struggle with it, I'll write some of the code for you, but since it's for a class I won't write it completely so as to help you learn so you can do it yourself next time. :)
1) Ask a user for an input.
2) Ask for AM or PM.
3) Add an if statement, saying that if the input is PM, to add 12 to the number, so as to convert it into a 24 hour system. (e.g. An input of "7" and "PM" would add "12" to "7" to give you "19", which is what they're saying.
4) Take this new variable number, and add it to the elapsed time variable. That'll give you a new variable at a new time. (e.g. "19" plus "9" would give a result of "28", your new time.)
5) Add a for loop, saying if your new variable is greater than 24, to subtract 24 over and over until the number is less than 24. (e.g., "28" is greater than 24, so it would subtract 24, leaving you with "4", which is the time 9 hours after your starting time of 7 PM.)
6) Add another if statement, stating if the number is less than 12, to print the number and add the AmPm variable, and if the number is greater than or equal to 12, subtract 12 from it to get the number in 12-hour format instead of 24, and then add the AmPm variable so as to display Pm.
I hope this all made sense, I can add a little bit of a shell for you to follow if this is confusing, but hopefully it makes enough sense for you to follow.