What is the speed of a wave with wavelength=150 m and T=9.8 s, when it is moving through water 40 m deep? What is its speed when the wave reaches water of 5 m depth?

If you know the length and the period, that gives the speed without doing anything about the speed of a wave in deep or shallow water. The question is misstated I think. speed = length/period. = 150/9.8 = 15.3

Now as to the real question, what is the speed of a deep water wave of 150m length, that is a real question.
In general the speed of a gravity water wave is given by
c^2 = (g/k) tanh (kh)
where
g = gravity acceleration = 9.81 m/s^2
k = 2 pi/wavelength L
h = water depth
In very deep water (deeper that half a wavelength this approaches c^2 =g L/(2 pi) or speed proportional to sqrt(L)
In very shallow water c*2 = gh or speed proportional to sqrt depth

For L = 150 m and h = 5 m
This is shallow water
c=sqrt(9.81*5) = 7.00 m/s

For 40 m better do the tanh (2 pi h/L)
tanh ( 1.6755) = .932
so
c^2 = [9.81*150/(2 pi)].932
c = 14.77 m/s

for comparison the speed of a 150 m wave in deep water would be
c = 15.3 m/s so our h =40 m speed is pretty close to deep water wave speed. The wave begins to feel the bottom when the water is about half a wavelength deep.
That 15.3 is what they gave you in the problem statement so I guess they meant in deep water.

Perhaps they meant the same wave as it comes in toward the beach from the ocean, in which case only the period stays the same (9.8s) and the wavelength shortens.

To do this start with my work above and use the resulting speed at h=40m to compute a new wavelength with that period. L = c T =9.8 c
Then use that wavelength to compute a new speed. Then do it again. It will converge rapidly to a new shorter wavelength and lower speed for the same period.
Do the same for the 5 m depth which will not converge so quickly.
This sure is a confusing question. Is it in a text?

To calculate the speed of a wave, you need to use the wave equation:

v = λ / T

where:
v is the speed of the wave
λ (lambda) is the wavelength of the wave
T is the period of the wave (time taken for one complete cycle)

Let's calculate the speed of the wave when it is moving through water 40 m deep:

Given:
λ = 150 m
T = 9.8 s

Substituting the given values into the wave equation, we have:

v = 150 m / 9.8 s

Calculating this, we find:

v ≈ 15.31 m/s

Therefore, the speed of the wave when it is moving through water 40 m deep is approximately 15.31 m/s.

Now, let's calculate the speed of the wave when it reaches water of 5 m depth:

The speed of the wave will remain the same, regardless of the depth of the water. The depth of the water does not affect the speed of the wave; it only affects the amplitude and other properties of the wave.

Therefore, the speed of the wave when it reaches water of 5 m depth will also be approximately 15.31 m/s.