There is a constant acceleration, $-g= -9.8 m/s^2$ so after time t, the speed is $v(t)= v_0- 9.8t m/s$ where $v_0$ is the initial speed. The problem says that the velocity is $40- 10t$. I suspect that "10" is an approximation to g= 9.8 so that $v_0= 40 m/s$.
The height after t seconds will be $h(t)= 45+ 40t- 5t^2$ (the "45" is the initial height at t= 0).
The "ground" is at h= 0 so to find the time until the ball hits the ground you need to solve the equation $h(t)= 45+ 40t- 5t^2= 0$ for t.
First divide both sides by -5 to get $t^2- 8t- 9= (t- 9)(t+ 1)= 0$. The roots are t= 9 and t= -1. Since the ball cannot hit the ground before it was thrown up, t= 9. The ball hits the ground 9 seconds after being thrown upward.
(t= -1 can be interpreted as when the ball could have been thrown up from the ground to be at 45 feet at t= 0.)