Well, programming is a skill learnt by doing, not by looking at other people's completed examples.
If I were to write this code for you then that'd get you absolutely nowhere; you wouldn't learn anything, and next time you had an assignment you'd be just as stuck and back here for someone to be "so nice as to help you fail the course", because if there's a final exam where you have no internet access then you'll have absolutely no chance.

So, no, you'll have to write this code yourself. As your tutor says, read the book, and I'm sure you'll find stuff in there that will help. I understand you want a quick fix, but that isn't how programming works. What book is it? If I have access to a copy somewhere I might be able to give you some pointers.