I think it's appropriate to speak to your supervisor first, and tell them that you are going to resign, and hand in a two weeks notice soon. That way, when you hand them a written letter, there's not a huge question mark on their face.
You can ask to speak to your supervisor in private, and just let them know that you would like to resign for whatever reason. Then say that you will hand in a written letter within a few days. In the letter, try to be polite so that you will have a good reference, even if you didn't really like the job. The very first job I had in high school I worked at for three years. Toward the end, I noticed that my supervisors had begun to take advantage of my very good work ethic and kind nature, and would work me to the bone but would never really appreciate it. I finally quit, and in my letter wrote that I was i wanted to focus more on school, though really, I just wanted to get the hell out of there and find a better job. But since I was nice, and worked well with them, they gave me a really great recommendation to future employees, and still do even though that was 7-8 years ago.