Read a count and then that many name/score pairs, and write them out as CSV rows — one name,score per line — using a PrintWriter.
For 2 then Ada 90 Sam 55:
Ada,90
Sam,55
Here the writer is aimed at the screen. Pointed at a file instead, the same code writes the file — and remember to flush().