Review the item:
When Javier was supposed to be in trigonometry,
he was instead flirting with pretty girls in the cafeteria needless
to say, he was inadequately prepared to make the 98 that he needed on the
final exam to pass the course.
When Javier was supposed to be in trigonometry is a subordinate clause, which cannot stand alone as a complete sentence. He was instead flirting with pretty girls ... is a main clause. When a subordinate clause introduces a main clause, you should use a comma between the two.