in secret key cryptography, which is your classic "coding" scheme, there is only one key to both encrypt and decrypt the message
in public key cryptography, however, there are TWO keys which are paired together. anything encrypted with one key must be decrypted with the other key.
normally, a person has a "public key" and a "private key." he/she makes the public key known to everyone, and keeps the private key to him/herself. anyone wishing to send that person a message can encrypt it with the public key, and no one else can read it since it can only be decrypted with the private key. (this is the scheme used when you login to a website under a secure connection)
there are already many algorithms for public key encryption, the most widely used being RSA. note, however, that there is a lot of math involved, so hopefully you payed attention in class :D
wikipedia has a page on RSA with full details on its operation: http://en.wikipedia.org/wiki/RSA
you might take some cues from this algorithm