Here is another way we could solve this problem with some simple calculus. We first start by maximizing the utility function subject to the budget constraint and the time constraint.
$$\underset{L,C}{max}\;\underset{s.t.\;C=100+w(40-L)}{L^{1/2}C^{1/2}}\qquad (1)$$
$$\underset{L}{max}\;L^{1/2}[100+w(40-L)]^{1/2}\qquad (2)$$
$\textbf{FOC:}$
$$\bigg(\frac{100+w(40-L)}{L}\bigg) ^{1/2}=w\bigg(\frac{L}{100+w(40-L)}\bigg) ^{1/2}\qquad (3) $$
With some math
$$L=\frac{50+20w}{w}\qquad (4)$$
Let $N$ be the number of hours worked. If you plug 5 and 8 in for $w$, you get 10 and 13.75 for $N$ respectively.
Now we have two points $(5,10),(8,13.75)$. Solving for slope we get $\frac{13.75-10}{8-5}=1.25$.
Now we must consider the intercept. Because $w=0$ is not defined, we must use the other intercept (where labor hours equal zero).
$$40-L=0\implies 40-\bigg(\frac{50+20w}{w}\bigg)=0\qquad (4)$$
With some math, we get $w=2.5$
$$\implies\qquad N=1.25(w-2.5)\qquad (5)$$
If we did not want to impose the restriction of linearity on the relationship between labor hours and real wage, we would simply use equation (4):
$$N=40-\bigg(\frac{50+20w}{w}\bigg)\qquad (6)$$
I know your question specified a linear relationship between labor hours and real wages, however this method of solving this question does not impose this restriction, which is nice because, as we can see, the relationship between labor hours and real wage is not actually linear.