Answer
36 hats and 9 tee shirts.
Work Step by Step
We first write the word problem as an equation. Next, we solve the equation using substitution. Doing this, we find:
$$ x+y=45, 14.5x+19.5y=697.5 \\ \frac{29}{2}\left(45-y\right)+\frac{39}{2}y=\frac{1395}{2}\\ y=9 \\ x=45-9 \\ x=36$$