assignment2 with output file