A spring with a constant of 6 (kg)/s^2 is lying on the ground with one end attached to a wall. An object with a mass of 6 kg and speed of 2 m/s collides with and compresses the spring until it stops moving. How much will the spring compress?

the Kinetic energy $\frac{1}{2} m {v}^{2}$ after the collision and the compressione becomes the elastic energy of the spring $\frac{1}{2} K {X}^{2}$.
so $\frac{1}{2} m {v}^{2} = \frac{1}{2} K {X}^{2}$ or $m {v}^{2} = K {X}^{2}$ and resolving for X you have $X = \sqrt{\frac{m}{k}} v = \sqrt{\frac{6 K g}{6 \frac{K g}{s} ^ 2}} 2 \frac{m}{s} = 2 m$