Unless your institution has a specific style guide for writing and formatting code (which, by the existence of this question, I assume you do not), speaking as someone who writes technical documentation to software:
The font which I generally use is Cambria or the Serif-family of fonts, size 11, 0.5 spacing for text. Nevertheless, I have specifically been instructed to use these fonts.
For code, use font where exactly each character takes up the same amount of space as any other character. Source Code Pro is a good example of such a font.
Code should stand out or otherwise be easily distinguishable, so put in in a box. Above all (as mentioned above) code formatting should be like it is found in an IDE or text editor, so each character takes up the same amount of space. For example,
This is a program which prints "Hello World!" to the console.
String s = "Hello World!";
I've usually been hesitant to include comments in the code blocks, especially if your document is already explaining what the code does.
Another thing which you could certainly do is simply take screenshots of code from your IDE/text editor, crop it in a image-editing program and simply paste the resultant image into your document editor. This can be nice, since usually IDEs have things such as line numbers which are otherwise unavailable in pre-formatted text.
Unfortunately, I cannot offer much more advice, since when it comes down to questions about technical writing, the answers is "it depends". Different institutions have different needs, and, to be honest, if they haven't given you a decent idea of how they want something formatted, either they're acting unprofessionally or aren't too fussed about details as long as the message gets across.