There is an easy way to solve for problems like this one. Here we will solve for every variable. First, I like to start with a simple setup like this:
x
y
Vf=
Vf=
Vi=
Vi=
D=
D=
a=
a=
t=
t=
Now put in the variables you know.
x
y
Vf=5m/s
Vf=
Vi=5m/s
Vi=0m/s
D=
D=40m
a=0m/s^2
a=10m/s^2
t=
t=
We know that Vi for the horizontal is 5 m/s and since air resistance is negligible, the Vf is the same. The acceleration across is zero because the velocity doesn't change. The Vi in the vertical direction is zero because the loogey is spit perfectly horizontally. The Distance of 40 m is given and the gravity is always g on earth. Now we can solve for the Vf in the vertical direction by using the equation
(Vf)^2=(Vi)^2+2aD
Using this equation, plug in your vertical variables and solve for Vf. You should get 28.3 m/s. Now using a different equation, you can solve for time.
D=(Vi)t+.5at^2
Now plug your vertical numbers in and solve for the
time. You should get an answer of 2.8 s. Your time vertical
is the same as your time horizontal for obvious reasons. Now plug
your vertical numbers into the second of the two equations and solve for
the distance horizontal. You should get 14 m. So the loogey
traveled a distance of 14 m in 2.8 s.