How do I do this , it is very confusing

Given
[tex]\begin{gathered} g(x)=x^2-10x+19 \\ 0\leq x\leq8 \end{gathered}[/tex]Answer
[tex]\begin{gathered} g(0)=0^2-10(0)+19=19 \\ g(18)=8^2-10(8)+19=64-80+19=3 \\ \text{Average = }\frac{-3-19}{2}=\frac{-22}{2}=-11 \end{gathered}[/tex]