Unfortunately, the majority of the "homework posts" fall into the "just show me the code" category, without displaying any hint of what they have tried. I see in your original post that you had some extra information there than what we normally see, so to you, my young friend, I say bravo!
You'll also notice that we tend to derail threads away from the original context, but don't hold that against us. It also happens when we see something shiny.
For future homework questions, let us know it's homework, give us what you think the answer is (or show what you've done so far, if it's a program question), and we'll be happy to point you in the right direction.
Oh okay, I understand. Next time I have a question on PLCs and it's linked to homework I'll be sure to point that out. Thank you all for the help.